You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/05/04 18:28:05 UTC

DO NOT REPLY [Bug 48817] Skip validation query and use JDBC API for validation

https://issues.apache.org/bugzilla/show_bug.cgi?id=48817

--- Comment #4 from Matt Passell <mp...@grovehillsoftware.com> 2010-05-04 12:28:00 EDT ---
Created an attachment (id=25398)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25398)
If no validation query is available, fall back on other approaches

This isn't exactly what was discussed, but it's an alternative solution.  I
added logic so that PooledConnection.validate() falls back on other validation
approaches when a query isn't available.  It first calls Connection.isClosed().
 The Javadoc for that method suggests that it isn't useful for validation, but
my client managed to create a situation where he had closed connections in the
pool.  Next, it uses Java reflection to look for the Connection.isValid()
method and calls it if it exists.  If it's not available or doesn't work (the
JDBC/ODBC bridge doesn't support isValid(), for example), it falls back on
calling Connection.getMetaData(), which should in theory exercise the
connection.  If it doesn't, we could always go further and actually call a
method on the returned DatabaseMetaData.  Let me know what you think.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org