wrote:
>
> In DB2, is it possible to update a table having a BLOB using
> a statement such as "SELECT MY_BLOB_FIELD FROM MY_TABLE FOR UPDATE"
>
> Then getting the Blob and writing to the Blob's output stream ?
>
> I'm getting an AbstractMethodError suggesting that the DB2
> driver I'm using didn't implement setBinaryStream.
>
> I can update the Blob without writing to an OutputStream,
> but I'm migrating a lot of code from Oracle and I'd perfer
> not to rewrite about 30 files manipulating blob/clob code.
>
> Here is a specific example :
>
> String sql = "select my_blob from my_table where my_table_id = 3 for
> update";
> con.setAutoCommit(false);
> stmt = con.createStatement();
> rs1 = stmt.executeQuery(sql);
> if (rs1.next()) {
> java.sql.Blob blob = rs.getBlob(1);
> OutputStream os = blob.setBinarySteam(); // error occurs here
> byte[] data = "Some data";
> os.write(data);
> os.close();
> }
> con.setAutoCommit(true);
>
> Um.. I'm using standard DB2 type 2 drivers ...
Sounds like DB2 doesn't support JDBC 3 java.sql.Blob in those drivers. Before JDBC 3,
you couldn't change the contents of a Blob.
--
Lee Fesperman, FFE Software, Inc. (
http://www.firstsql.com)
================================================== ============
* The Ultimate DBMS is here!
* FirstSQL/J Object/Relational DBMS (
http://www.firstsql.com)