You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jonathan Mangano <jo...@pslgroup.com> on 2002/12/09 21:41:03 UTC

Recovering from dropped connections when using commons DCBP

I am using the DCBP connection pooling with Tomcat 4.1.12. Everything works fine except when a connection dies because of some external factor (In my case it is a clearing of the the Cisco Routers xlate table or a firewall reset which causes a SocketException). When this happens the JDBC driver I am using throws an SQLException with a specific SQLState, so I am able to identify when it occurs. If this happens when the DCBP pool is opening a new connection it wraps the SQLException in a DCBPException, so again I can identify the problem.

What I cannot do is get another working connection. It appears the Connection pool is in a bad state so that I get the same exception when I request another connection. Is there a way to get around this by resetting the connection pool or removing the dead connection?

Thanks
Jonathan


Re: Recovering from dropped connections when using commons DCBP

Posted by Rodney Waldhoff <rw...@apache.org>.
One quick fix is to set the validationQuery property in your JNDI
configuration to some fast query that returns at least one row, for
example "SELECT 1" or "SELECT DUMMY FROM DUAL".  This will allow DBCP to
validate the query before returning it your client code.

You may also find the comments at
<http://issues.apache.org/bugzilla/long_list.cgi?buglist=14592>
helpful.

If you need more detail, please follow up.