PreparedStatement.setBinaryStream Javadoc
Bernd Eckenfels
ecki at zusammenkunft.net
Fri Feb 1 09:09:28 UTC 2019
Hello,
The JavaDoc for some of the setBinary/ASCII... methods of PS say something about „more practical“ but it is not clear if it means this method is more practical than another method, or if this method should not be used in favor of another.
When a very large binary value is input to a LONGVARBINARY parameter, it may be more practical
to send it via a java.io.InputStream object.
Also, does this not apply to BLOB or VARBINARY?
I would clarify this to something like (if I understood the meaning correctly):
For large content the use of an InputStream/Reader can avoid keeping the data in memory,
It however depends on the driver how the data is internally processed or buffered.
BTW those functions do not mention if the stream is closed or not.
After the method returns the stream is not closed.
Some more clarifications could also be given (not sure if all of them are correct):
The stream is positioned after the specified length.
The reading blocks till the end of stream is signaled (will not return when abailable()==0)
EOFException is thrown If stream is shorter than specified length.
Gruss
Bernd
--
http://bernd.eckenfels.net
More information about the core-libs-dev
mailing list