As per my understanding, JDBC Connection Pooling (at a basic level) works this way:
- create connections during app initialization and put in a cache
- provide these cached connections on demand to the app
- a separate thread maintains the Connection Pool, performing activities like:
- discard connections that have been used (closed)
- create new connections and add to the cache to maintain a specific count of connections
But, whenever I hear the term "connection reuse" in a JDBC Connection Pooling discussion, I get confused. When does the connection reuse occurs?
Does it means that Connection Pool provides the same connection for two different database interactions (without closing it)? Or, is there a way to continue using a connection even after it gets closed after a DB call?