tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Mikusa <>
Subject Re: Tomcat JDBC pool - auto reconnect
Date Fri, 10 Oct 2014 14:35:45 GMT
On Fri, Oct 10, 2014 at 9:51 AM, Vasily Kukhta <> wrote:

> Hi friends,
> I have a question regarding the ability of Tomcat JDBC pool to reconnect
> automatically to a database in case of temporarily network failures.
> I'm developing a high-load application which uses Oracle 11g database. It
> may happen that the DB can become unavailable for several minutes - it is
> located in another geographic region, so network failures can happen
> sometimes and the DB becomes unresponsive. Can the Tomcat JDBC pool
> automatically reconnect to the DB when it becomes online again?

In a manner of speaking.  You can configure the pool to test connections,
remove bad ones and try to replace them with new, good connections.  See
"validationQuery", "testWhileIdle and "testOn*" here.

The trick is that the pool doesn't know when your DB comes back online, so
you might get exceptions while the DB is offline (especially if it's down
for a long time).  It will start talking again once the DB comes back
online though.

> Is this done by default or it should be configured somehow?

No.  You need to set a validation query and set at least one of the "test*"
attributes to "true".


> Thank you in advance!
> Best regards,
> Vasily Kukhta.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message