On Fri, Oct 10, 2014 at 9:51 AM, Vasily Kukhta <v.b.kuk...@gmail.com> 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. http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Common_Attributes 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". Dan > > Thank you in advance! > > Best regards, > Vasily Kukhta. >