Yes, I believe that you must use a PreparedStatement in order to use setBinaryStream(). That's how I always do it (with Derby and other SQL databases). As Sriram said, Blob is an interface and there is no means of creating a Blob directly.

You can get a java.sql.Blob object from a ResultSet; i.e. I retrieve my byte[] from a blob with

Blob b = r.getBlob(resultSetIndex);
byte[] ba = (byte[]) b.getBytes(1L, (int) b.length())



Reply via email to