Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JDBC issues with setBinaryStream an AbstractMethodError and a cast

Reply
Thread Tools

JDBC issues with setBinaryStream an AbstractMethodError and a cast

 
 
gimme_this_gimme_that@yahoo.com
Guest
Posts: n/a
 
      05-19-2005
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 ...
Might there be a way to get around this by casting to
something DB2 specific (what?) and fetching the
output stream from that? Like

OutputStream os = ((DB2.SOMETHING)blob).getBinaryOutputStream();

 
Reply With Quote
 
 
 
 
Lee Fesperman
Guest
Posts: n/a
 
      05-19-2005
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)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange runtime error: AbstractMethodError Oliver Wong Java 11 02-09-2007 12:17 AM
java.lang.AbstractMethodError: at the org.apache.xerces.dom.DOMImplementationImpl.createLSOutput() poorichard@gmail.com Java 2 09-18-2006 02:08 AM
stand-alone JMS, other JDBC operations, and transactions ( ActiveMQ + JOTM + JDBC operations ) Jesus M. Salvo Jr. Java 2 02-11-2006 06:33 PM
JNI -- getting AbstractMethodError Jeff Gaynor Java 1 05-25-2004 02:47 PM
debugging java AbstractMethodError Bin Xin Java 3 08-18-2003 03:23 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57