We had a similar problem in our application. We figured out, the reason was
our firewall. It dropped the connection from our application to the database
after one hour of inactivity instead to close the connection. Therefore our
application didn't realized that the connection was dead. It run the query
to the database to check the connection when borrowing it from the
connection pool and read from the response stream. But the response stream
didn't return any data. After a long time (30 minutes or so) we received an
exception because the OS terminates the connection.

The solution for us was to run the validation query (SELECT 1 FROM DUAL)
also for idle connections in the pool (after each 5 minutes). This makes
sure the firewall doesn't drop the connections to the database. We are using
the Apache Commons database pool (commons-dbcp).

Hope this helps.

Best,
Christian

Reply via email to