Created attachment 27771 [details] Adds a new interceptor class Custom Tomcat JDBC Pool interceptor which reconnects a JDBC Connection on failure. This was written to support automatic failover of a SQL Server database configured with database mirroring and using the Microsoft SQL Server JDBC driver, configured to support failover. It is hoped this interceptor may be more generally useful for supporting reconnection on failure but is untested on any database other than SQL Server 2008 R2.
I like the idea, but it's not fine grained enough. What if I do 1 con = getConnection(); 2 con.close(); 3 con.executeQuery(); on step 3 we reconnect the connection only to fail identically again.