I have implemented HikariCP which is working fine and I'm now planning to do a graceful shutdown of my application and I would like to make HikariCP close the database connection properly and not just killing the java application. I was reading on google and I could see the HikariDataSource should have a close method.... but in fact I'm not able to see it available:
private static DataSoure ds;
:
public blabla() {
HikariConfig config = new HikariConfig();
config.setJdbc(jdbcURL);
:
ds = new HikariDataSource(config)
In Eclipse, if I tried ds.close()... Eclipse does not showing "close" as a valid method for HikariDataSource:

Am i doing something wrong? Probabily.... Any idea on how to make HikariCP to close properly the database connection?
Thanks, Helio
You declare ds as javax.sql.DataSource and assign it with HikariDataSource. This way you will not have access to HikariDataSource native method.
((HikariDataSource)ds).close();
would do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With