-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Closed DB connection when calling Blob.getBinaryStream()
PostPosted: Sun Apr 03, 2005 8:04 am 
Newbie

Joined: Sun Apr 03, 2005 7:55 am
Posts: 1
Hello to all,

we're caching all objects by an own-build java cache. One object contains a Blob, which is read by the application with the getBinaryStream()-method. After having started the application, everything runs fine.

However, after running a while (~1 hour or so), calling the getBinaryStream()-method leads to the following error:

Caused by: java.io.IOException: Must be logged on to server
at oracle.jdbc.driver.DatabaseError.SQLToIOException(DatabaseError.java:557)

I assume, that hibernate closed the connection to the database after a while. When taking the Blob out of the own-build cache, the connection might have already been closed by hibernate. How can I enforce hibernate to reopen the connection for the specific object?

Thanks in advance,

Volker


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 04, 2006 7:43 am 
Newbie

Joined: Wed Mar 02, 2005 1:28 pm
Posts: 18
Well just looking at the subject line "Closed DB connection when calling Blob.getBinaryStream()" makes me think of trying to access the BLOB data stream in a succeeding transaction, ie:

hibSession = ...

tx = beginTransaction();
myBean = myDao.findById( id );
tx.commit();

tx = beginTransaction();
... myBean.getMyBlobMember().getBinaryStream();
tx.commit();

hibSession.close();

The above scenario would be typical when using a long session. Oracle LOB locators are normally only valid in the same transaction as they were loaded in, so getBinaryStream() above could only be called in the first transaction above. And yes, Oracle will complain about "closed connection" while it is really only the transaction that is gone.

//Mike


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.