Jdbc validation request

Is there a library that can determine the appropriate validation request to use for the jdbc driver class?

For example, if the jdbc driver is com.mysql.jdbc.Driver or com.mysql.jdbc.jdbc2.optional.MysqlXADataSource, the library will know that the validation request is "SELECT 1"

c3po http://www.mchange.com/projects/c3p0/index.html#preferredTestQuery

DBHP http://commons.apache.org/dbcp/configuration.html "ValidationQuery"

+6
java validation jdbc
source share
2 answers

JDBC type 4 provides the isValid method

+8
source share

I do not think the library is a suitable place for such a thing.

If you use a connection pool, most likely you will ask it to check the connections before transferring them. You simply enter the appropriate SQL and let the pool process it. The library will be a step back because it means that your code will call it.

0
source share

All Articles