commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryunix <budianto.chu...@gmail.com>
Subject Re: Using DBCP with Hibernate - How to reconnect if the poolable connection is closed
Date Fri, 17 Apr 2009 19:33:24 GMT

Hi Carman,
I had already set the validation query and enable the removeAbandoned to
true.
It seems that on some occasion when the removeAbandoned closes the
connection, it will close the underlying poolable connection, and when my
application uses the connection, i can see that the connection object
returned by session.getConnection() would have the value isClosed=false, but
when I expand the connection object to the poolable connection, i can see
that isClosed=true.




jwcarman wrote:
> 
> You can turn on the connection validation [1] by supplying a
> validation query.  Then, DBCP can test if the connection is okay when
> it tries to let you borrow it.
> 
> [1] http://commons.apache.org/dbcp/configuration.html
> 
> 
> On Fri, Apr 17, 2009 at 2:07 PM, Ryunix <budianto.chuang@gmail.com> wrote:
>>
>> Dear All,
>> we have an application which using hibernate with DBCP.
>> and the application will access the database using hibernate session
>> which
>> obtain the connection from the dbcp pool. The application will provide
>> webservices to be used by other application.
>>
>> In some cases where the 'poolable connection' obtained by the hibernate
>> session is closed, our application will throw error saying the connection
>> is
>> closed to the webservice client, and this error will only occur at that
>> particular web service call. At the next call, the webservice can return
>> result to the caller successfully.
>>
>> To prevent the error, we had added an intermediate 'loop' function to
>> test
>> the connection obtained by the session, if the connection (poolable
>> connection) is closed, we will issue conn.close() and release the session
>> .
>> However, it seems that the connection obtained through
>> session.getConnection() at every loop is always the same, and hence would
>> have the same 'connection is closed' issue.
>>
>> May I know if there is any way for me to force the session.getConnection
>> to
>> return me a new 'valid' connection?
>>
>> Thanks guys in advance
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Using-DBCP-with-Hibernate---How-to-reconnect-if-the-poolable-connection-is-closed-tp23102913p23102913.html
>> Sent from the Commons - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-DBCP-with-Hibernate---How-to-reconnect-if-the-poolable-connection-is-closed-tp23102913p23104475.html
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message