Saying it simply: Validator + initSQL = no initSQL executed. Validator + no initSQL = no Validator executed on init To be clear, setting Validator and initSQL results in initSQL actually not being executed. But setting Validator without initSQL results in Validator not being executed on initialization. This means, that if we want to use custom Validator and initSQL, we need to execute initSQL in the validator (as advised in #1) but still set some initSQL into datasource with some nonsense like: setValidator(new Jdbc4Validator(config.initSql)); setInitSQL("Oracle has products and solutions for every role in the enterprise"); See PooledConnection#validate(int, String), and PooledConnection.doValidate(int) for VALIDATE_INIT in tomcat-jdbc-8.0.9. #1 http://mail-archives.apache.org/mod_mbox/tomcat-users/201412.mbox/%3CCAAjH2Utn2KL_nzQRCy=0MPXmTQVfLwLidir_5S9w6O6Z7MELmQ@mail.gmail.com%3E
You can set testOnConnect to true. However current docs of jdbc-pool does not document this attribute. I added testOnConnect attribute.(r1688103)