db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barnet Wagman <b.wag...@comcast.net>
Subject Re: How to invoke methods of Blob interface
Date Sun, 20 Feb 2005 01:56:42 GMT
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())

View raw message