db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From epdv <peter.nabbef...@gmx.de>
Subject How to read blobs?
Date Thu, 05 Mar 2009 13:38:14 GMT

Hello!

I want to read blobs in a loop (more exact: the length of the blobs). 
I'm using a connection with autocommit(true) and a prepared statement 
with sth. like "select mydata, myblob where mykey=?".

Then I'm using the following loop:

     while (rs.next()) {
         int m = wantedColumnNames.length;
         Blob blob = (Blob)rs.getObject(x);
         if (blob == null) {
             result = 0L;
         } else {
             result = blob.length();
             blob.free();
         }
         ...
     }

I'm always getting an error message saying that the blob cannot be 
released after closing, probably the transaction had already been 
committed. As connection is in autocommit mode, I assume it has already 
been closed after statement execution, but it I try non-autocommit mode, 
the resultset is not open after execute (at least derby says that). How 
can I get the expected result?

BTW, using derby 10.4.2.0 in client/server mode.

Kind regards

Peter


Mime
View raw message