I am using spring-boot in my web application and use spring-jpa to read/write from/to my database. It works very well but I want to understand how to manage the database connect
When using DB connection pooling, a call to sqlconnection.close()
will not necessarily close the heavyweight connection to the database, instead most often will just release the connection as re-usable in the pool. That's why it is advisable to invoke the close()
on connection as soon as possible when leveraging a client side connection pool.
In your configuration, the pool will contain a maximum number of 500 connections ( it would be also good to configure maxIdle
, minIdle
, and minEvictableIdleTimeMillis
to tune the number of ready-to-use connections and how often to release them when not used).
Some more doc here