We once had a Voice Portal application that utilized database socket and this socket was disconnected on timeout when no calls were made to VP, i.e. on weekends. DB server thought VP’s Application Server went dead and dropped the socket. Next time when a call came, VP tried to send data query in the socket, found it closed and threw up an exception. If you have similar troubles, here’s a piece of wisdom for you.
Quoting Wilson Yu (Avaya):
If you can’t get the appearent network issue resolved, you may think about adding the following parameter to the app’s context file in Tomcat’s conf/catalina/localhost directory:
validationQuery=”select 1 from <AnyTable>”
This will help Tomcat connection pool data source to reconnect to the database automatically without restarting the app server.
<Resource auth=”Container” dataSourceName=”java:/comp/env/jdbc/AccessDBCPDS” factory=”org.apache.tomcat.dbcp.dbcp.datasources.PerUserPoolDataSourceFactory” logAbandoned=”true” maxActive=”10″ maxIdle=”5″ maxWait=”10000″ removeAbandoned=”true” removeAbandonedTimeout=”300″ testOnBorrow=”true” type=”org.apache.tomcat.dbcp.dbcp.datasources.PerUserPoolDataSource” validationQuery=”select 1 from Users”/>
If you are working with MSSql 2005, you should use “select from getdate()” instead of “select x from table”. Also, you need a java 1.5 runtime environment. If you are using DD4.x, you should already have that.
database, timeout, Troubleshooting