Hi
I want to set a blob field through JDBC and Java 1.5. I cannot currently update to Java 1.6.
The blob can be very large. Let’s say, I have a 1 GB file. I cannot assume, that I have 1 GB free heap space. I want to directly stream the bytes into the blob. Hence I used setBinaryStream( 1, in, Integer.MAX_VALUE ) on the PreparedStatement. Unfortunately I have to pass the stream length to the method, because I am using Java 1.5. But this is stupid. I simply don’t know the stream length. And I cannot buffer the whole stream content in memory just to get the size, since it could be too large. Passing Integer.MAX_VALUE works, but blows up the memory consumption. A have also tried -1, but this has the same effect as Integer.MAX_VALUE.
So my question is: How can I set a blob field value from an InputStream without buffering more than necessary in memory?
Thanks in advance,
Marvin
