0

I'm trying to use the HikariCP to pool my database connections. Reading through their documentations quickly, I'm not sure if I should keep my HikariDataSource object in memory and always ask from the exact same object for new connections or can I instantiate a new HikariDataSource object each time I want to create a new connection?

Mehran
  • 15,593
  • 27
  • 122
  • 221

1 Answers1

0

It's preferred to create only one instance and use it for getting connection from pool using getConnection(), see also related answer that uses HikariDataSource in a singleton pattern

Ori Marko
  • 56,308
  • 23
  • 131
  • 233