True, using a Validator which checks if validateAction == VALIDATE_INIT and then performs the initSql itself will work. In my situation the validatorClassName was a configurable property, so I ended up creating a simple wrapper Validator which chooses between executing the initSql or calling the original validator. It’s a bit unintuitive to use the validator like that, but I’m glad to have it working ☺ Thanks for your responses!
From: Filip Hanik [mailto:fi...@hanik.com] Sent: woensdag 3 december 2014 19:47 To: Tomcat Users List Cc: Iris Hupkens Subject: Re: Tomcat JDBC connection pool: Using initSql together with validatorClassName You should be able to run init SQL commands yourself in your custom validator https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/tomcat/jdbc/pool/Validator.html On Wed, Dec 3, 2014 at 11:42 AM, Wes Clark <wcl...@guidewire.com<mailto:wcl...@guidewire.com>> wrote: These actions seems to incorrectly conflated in the code. I'd also like to do the same thing, so if you get it working, keep me posted. -----Original Message----- From: Iris Hupkens [mailto:i.hupk...@topdesk.com<mailto:i.hupk...@topdesk.com>] Sent: Wednesday, December 03, 2014 5:14 AM To: 'users@tomcat.apache.org<mailto:users@tomcat.apache.org>' Subject: Tomcat JDBC connection pool: Using initSql together with validatorClassName Hello, 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 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org<mailto:users-unsubscr...@tomcat.apache.org> For additional commands, e-mail: users-h...@tomcat.apache.org<mailto:users-h...@tomcat.apache.org>