Tomcat and orphaned JDBC connections
I am using Tomcat and Postgres an a site, but have a
problem with orphaned database connections.
All the connections are sourced from a connection pool,
and all accesses to the database are wrapped in a
finally clause to return the connection to the pool.
However, if a user hits a page button twice, terminating
the first request but creating a second one, the first
database connection is being left open.
Why is my first connection being left open?
I would have expected the original servlet invocation
to complete, but the thread is (apparently) being terminated
in the middle of the database query.
NB - I am currently working round it at the connection
pool, by trying to detect orphaned connections by using
the session ID, but this is really a band aid, not a solution.
Thanks for any ideas