I am trying to configure HikariCP for my web application. I am not using any frameworks, it is a plain simple java web app. When I tried to establish a connection through no
I was hitting the same problem, and I just figured it out.
I'm on a Mac, and somehow I had postgresql-9.0-802.jdbc3.jar installed in my /Library/Java/Extensions directory. DriverManager would pick this up as the preferred way of connecting to a jdbc:posgresql:// URL. It's a JDBC3 driver, so there's no isValid method.
Even when I put a JDBC4 Driver on my classpath, whether that was org.prosgreql.Driver or com.impossibl.postgres.jdbc.PGDriver, the JDBC3 driver would supersede it.
So I deleted /Library/Java/Extensions/postgresql* and all is well.
Actually I got the answer, Hikari needs to set a connection test query, if thats done JDBC4 isValid will not get called.
so just by adding property, I was able to make it work.
mConfig.setConnectionTestQuery("show tables");