Subject Re: [Firebird-Java] Insert StringBuffer into BLOB SUB_TYPE 1
Author Roman Rokytskyy
Hi,

> is it safe to insert a largish (possibly > 1MB) amount of data from a
> StringBuffer into a BLOB SUB_TYPE 1 field by using the following?
>
> ps.setString(2, xml.toString());
>
> where ps is a PreparedStatement and xml is a StringBuffer? Or do I have
> to use some kind of streaming?

No, it is enough to use setString() method. The only consequence is that
data will be kept in memory before the executeUpdate is issued. When you
use streams (InputStream) in non-autocommit mode, it will create BLOB,
pump data into database and keep in memory only the BLOB ID. But
nowadays 1 MB is not that much, so feel free to use setString.

Please note, when using setString, regular charset conversion takes place.

Roman