You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Werner Leithner <lo...@yahoo.de> on 2006/09/05 10:19:24 UTC

Store/Read images as Blob bigger than ~32kb

Hello!

I hope someone can help me.

I try to store images as blob into the database. It
seems to work fine as long the images are not bigger
than ~32kb. When I try to load an image that is bigger
than ~32kb i get the following exception:

SQL Exception: The data in this BLOB or CLOB is no
longer available.  The BLOB or CLOBs transaction may
be committed, or its connection is closed.

By the way i use derby in combination with hibernate.

Many thanks in advance.

wl



	

	
		
___________________________________________________________ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de

Re: Store/Read images as Blob bigger than ~32kb

Posted by Andreas Korneliussen <An...@Sun.COM>.
Werner Leithner wrote:
> Hello!
> 
> I hope someone can help me.
> 
> I try to store images as blob into the database. It
> seems to work fine as long the images are not bigger
> than ~32kb. When I try to load an image that is bigger
> than ~32kb i get the following exception:
> 
> SQL Exception: The data in this BLOB or CLOB is no
> longer available.  The BLOB or CLOBs transaction may
> be committed, or its connection is closed.
> 

I think you should check if it has been a transaction commit or
rollback, i.e because of autocommit.

When a transaction is committed, the BLOB/CLOB objects created in that
transaction are no longer valid, and you have to run a new query to
access the BLOB data.

If there is less than 32 kb in the BLOB, I think blob data is internally
handled differently (i.e the data does not go over multiple pages), and
Derby does not give an exception.

--Andreas



RE: Store/Read images as Blob bigger than ~32kb

Posted by de...@segel.com.
Just off the cuff...

It sounds like a problem with your hibernate configuration.
(Yet another reason why you should just write your own DAO class.) ;-)

What the error is saying is that you're trying to write blob/clob that has
been committed.

My guess is that you're writing in 32KB increments off the stream and after
the first increment, you're closing/committing the transaction via
hibernate's configuration.

But hey! What do I know? I'm still suspect of Hibernate/Spring/etc's ability
to scale.

-G

> -----Original Message-----
> From: Werner Leithner [mailto:lord_wl@yahoo.de]
> Sent: Tuesday, September 05, 2006 3:19 AM
> To: derby-user@db.apache.org
> Subject: Store/Read images as Blob bigger than ~32kb
> 
> Hello!
> 
> I hope someone can help me.
> 
> I try to store images as blob into the database. It
> seems to work fine as long the images are not bigger
> than ~32kb. When I try to load an image that is bigger
> than ~32kb i get the following exception:
> 
> SQL Exception: The data in this BLOB or CLOB is no
> longer available.  The BLOB or CLOBs transaction may
> be committed, or its connection is closed.
> 
> By the way i use derby in combination with hibernate.
> 
> Many thanks in advance.
> 
> wl
> 
> 
> 
> 
> 
> 
> 
> ___________________________________________________________
> Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail:
> http://mail.yahoo.de