how to read multiple (binary) lines from text file / stdin?

From: armin walland (
Date: 01/26/04

Date: Mon, 26 Jan 2004 09:38:23 -0600

hi group!

i am writing a small tool to dump data from oracle databases and i want
to implement the possibility to execute sql statements read from stdin
or from a file. i have so far managed to do so, but every sql statement
must be on a single line with no ";" at the end of each line.

i would like to use an input file like this:

-- file statement.sql --
select * from table
        where thing = "something";


-- file statement.sql --
update table
        set image = '<binary data>'
        where thing = otherthing;

this is how the code looks so far:

// code start

BufferedReader in = new BufferedReader(new FileReader(filename));

while (((statement=in.readLine())!= null) &&(!statement.equals(""))){
        try {
                ResultSet rset = stmt.executeQuery(statement);

// code end

i would like 'statement' to contain the multiline sql statement
including all newlines so that also binary data may be inserted into the
db so i tried to use

System.setProperty("line.separator", ";");

but that didn't help and also doesn't seem the right way for what i want
to achieve. could someone please point me into the right direction on
how to do that? the variety of different stream classes is somewhat
confusing in terms of finding the right class for the right job.

big TIA, armin

armin walland
maculangasse 8
1220 wien