SQLException: Stream has already been closed (Oracle)
Ok I have an Oracle DB with a table where one column is of type LONG. I have a select statement on that table:
SELECT COL1, COL2
FROM TABLE
WHERE
SOME CONDITION
COL2 is the LONG column.
I get the ResultSet and do:
String col1 = getString(1);
byte[] bytes = getBytes(2);
Sometimes this will work sometimes it throws an SQLException with Stream has already been closed.
This code is hit about 5 times in the one execution of the program but only fails once in about 3 runs of the program.
Has anyone encountered this itermitent behavior before on Oracle 10 using the thick driver?
[686 byte] By [
Ydassaca] at [2007-10-2 14:24:13]

> Sometimes this will work sometimes it throws an
> SQLException with Stream has already been closed.
> This code is hit about 5 times in the one execution
> of the program but only fails once in about 3 runs of
> the program.
What does the stack trace say?
From the Oracle docs,
http://www.lc.leidenuniv.nl/awcourse/oracle/java.920/a96654/basic.htm#1002507
http://www.lc.leidenuniv.nl/awcourse/oracle/java.920/a96654/basic.htm#1021780
The second section deals with precautions for using streaming data. The example provided illustrates that you need to access the stream data columns immediately. I hope this helps you.