tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Iris Hupkens <>
Subject Tomcat JDBC connection pool: Using initSql together with validatorClassName
Date Wed, 03 Dec 2014 13:14:17 GMT

I am using the Tomcat JDBC connection pool (version 7.0.55) as a stand-alone library. The
connection pool is configured with a custom validator class in order to use the JDBC4 isValid
method for connection validation.  I would also like to use initSql to perform some preparation
on all connections created in the pool (such as setting sorting to case insensitive under
Oracle). However, it appears that initSql does not work in combination with a validator class.

Looking at the source, the code that executes the initSql statement is skipped if a validator
class is configured. The documentation for initSql states that it is executed in place of
the validation query when connections are initialized, but the method which does the validation
first checks if there is a validator class that should be used instead, and then returns immediately.

I was wondering: is this a bug, or is it intentionally not possible? If it's intentional,
is there perhaps a different way to configure the Tomcat connection pool to use both a custom
validator class and execute initial SQL statements when first creating a connection?

Kind regards,
Iris Hupkens

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message