Kathey Marsden wrote:
On how to get stream length of the ResultSet.getBinaryStream(). I
talked about two options.
> 1) I have a fix in a maintenance branch of an old Cloudscape
>release which I could port. This does getString() or getBytes() to get
>the value and then has the associated length.
> 2) I'd actually have to call getBinaryStream twice, once to get the
>length (with available(), skip()) and again to stream
> the data to the client. Maybe this is not so bad since
>Blob.length() does something similar for large values, but actually
>reads the data, So I suppose for large values this might be faster than
>what we do now.
>
>
>
Option #2 just doesn't seem to work because I cannot figure out how to
reset the input stream. A second call to
rs.getBinaryStream() gives me:
SQLState: XJ001
Severity: 0
Message: Java exception: ': java.io.EOFException'.
java.io.EOFException
at
org.apache.derby.impl.jdbc.BinaryToRawStream.<init>(BinaryToRawStream.java:53)
at
org.apache.derby.impl.jdbc.EmbedResultSet.getBinaryStream(EmbedResultSet.java:1160)
at derby255.LargeDataLocks.testBinaryData(LargeDataLocks.java:84)
at derby255.LargeDataLocks.testLocks(LargeDataLocks.java:58)
at derby255.LargeDataLocks.main(LargeDataLocks.java:39)
mark/reset is not supported. I am leaning toward option 1, but wanted
to give one last appeal before I go that route.
Any ideas on how to reset the input stream after getting the length?
Kathey