db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: How to read blobs?
Date Fri, 06 Mar 2009 11:08:37 GMT
epdv wrote:
> Kristian Waagan schrieb:
>> epdv wrote:
>>> Thank You for the answer - but I've also got problems with
>>> autocommit(false): Recordset not open. How can I get the InputStream
>>> then, and can I access the opened InputStream independently from the
>>> blob, i.e. can I read the stream still after freeing the blob?
>> You can operate on the Blob until you commit or rollback if you turn off
>> autocommit.
>> As soon as you call Blob.free(), the Blob object, or any objects
>> obtained from it (like an InputStream), cannot be used any more. This
>> holds regardless of whether you have committed/aborted or not.
> If I understand correctly, I'll need to open one connection per opened 
> (not yet closed) stream then. How can I open a pooled connection then, 
> without using J2EE (can only find docs for j2ee ... :-( )?

I'm not sure I understand.

You can have streams from many Blobs open as long as you don't commit or 
  abort the transaction.
If you want to access the Blob content after you have called 
Blob.free(), you have to make a local copy of the Blob - for instance 
copying the content into a byte array and then create a 

Maybe someone can give you some hints if you describe what you actually 
want to do. Why do you need to access the Blob after you have freed it?
Maybe there's no need to do that, and you just need to slightly adjust 
the way you are processing the data.

My first advice would be to make your code work with autocommit turned off.


>> The problem you see with the result set, must be something else.
> I'll look at this later, as cannot use my current code, thus problems 
> might disappear just while doing my changes, as a "side-effect" ;-)
> Kind regards
> Peter

View raw message