A connection pool is a cache of database connections (connection objects) maintained in the database’s
memory so that the connection can be reused when the database receives future requests for data.
Connection pools are used to improve the perfomance of executing the commands on a database.
Opening and maintaining a database connection for each user, especially requests made to a dynamic
database-driven website application is costly and wastes resources.
Once the connection is created, it is placed in the pool and it is used over again so that a new connection
does not have to be established.
If all the connections are used up a new connection is made and is added to the pool.
The connection to be established is data store dependent; therefore, the time to be consumed while
opening or closing a connection differes in different databases, such as Oracle, MySql, and SQLServer.
Opening or closing a data store session increases load on the database, which affects the availability and
performance of the application.
In addition, opening closing a session(connection) to data store is a resoure consuming process.
To solve all these problems, the pooling mechanism is used to establish connections before the clients
makes a request.
In other words, the connection objects created to represent the session established to the data store
pooled and recycled for further use.
This mechanism is known as connection pooling in which a connection is retrieved from the pool, used by
an application, and then returned to the pool. The pool contains the objects of the physical connections.