commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Carman <>
Subject Re: Using DBCP with Hibernate - How to reconnect if the poolable connection is closed
Date Fri, 17 Apr 2009 18:13:22 GMT
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.


On Fri, Apr 17, 2009 at 2:07 PM, Ryunix <> 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:
> Sent from the Commons - User mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message