Subject Re: creating BLOB's.. may be a off topic
Author dj_begemot
--- In Firebird-Java@yahoogroups.com, "Nikolay Ivanchev"
<nivanchev@i...> wrote:
> Hello all,
> Blob in java.sql is interface.
> When recieved via ResultSet is easy to get a BLOB.
> But how to send a BLOB into database. I have done it via file,
> but the situation is that I have created Image (from IconImage) and
> I want to send this Image into BLOB...
> Can some one help
> Niki

You can set blob via java.sql.PreparedStatement object:


byte[] blob_val =...
PreparedStatement pstmt = con.prepareStatement("INSERT INTO
blob_table (ID, BLOB_COL) VALUES (?, ? )");
pstmt.setInt(1, 1);
//simply
pstmt.setBytes(2, blob_val);
//or
pstmt.setBinaryStream(2, new ByteArrayInputStream(blob_val),
blob_val.length);
//or via another setXXX method
pstmt.execute();