tomekw/hikari-cp

not-core-options being sent to Underlying JDBC driver causing fatal exception

sbitteker opened this issue · 2 comments

When you add the pool initialization option :connection-init-sql it is not removed on this line. By not removing this option the code uses reflection to attempt to call setConnectionInitSql on the underlying Java JDBC driver. When it's not found you'll get a java.lang.RuntimeException: Property connectionInitSql does not exist on target class org.postgresql.ds.PGSimpleDataSource. The driver doesn't have such a method. The setter is called from HikariCP. The fix for me was to add :connection-init-sql to the list of keywords to dissoc

Versions used: [hikari-cp "1.6.1"]

Caused by: java.lang.RuntimeException: Property connectionInitSql does not exist on target class org.postgresql.ds.PGSimpleDataSource
at com.zaxxer.hikari.util.PropertyElf.setProperty(PropertyElf.java:148)
at com.zaxxer.hikari.util.PropertyElf.setTargetFromProperties(PropertyElf.java:62)
at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:293)
at com.zaxxer.hikari.pool.PoolBase.(PoolBase.java:84)
at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:102)
at com.zaxxer.hikari.HikariDataSource.(HikariDataSource.java:71)

Fixed in pull request: #31

Merged #31, thanks for the fix @sbitteker!