Connection pool

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In software engineering, a connection pool is a cache of database connections maintained so that the connections can be reused when future requests to the database are required.[citation needed] Connection pools are used to enhance the performance of executing 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. In connection pooling, after a 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 being used, a new connection is made and is added to the pool. Connection pooling also cuts down on the amount of time a user must wait to establish a connection to the database.


Connection pooling is used in web-based and enterprise applications and is handled by the application server. Dynamic web pages without connection pooling open connections to database services when they are needed and close them when the page is done servicing a particular request. Pages that use connection pooling instead maintain open connections in a pool. When the page requires access to the database, it simply uses an existing connection from the pool, and establishes a new connection only if no pooled connections are available. This reduces the overhead associated with connecting to the database to service individual requests.

Local applications that need frequent access to databases can also benefit from connection pooling. Open connections can be maintained in local applications that don't need to service separate remote requests like application servers, but implementations of connection pooling can be complicated. There are a number of libraries available that implement connection pooling and related SQL query pooling, simplifying implementation of connection pools in database-intensive applications.

Connection pools can be configured with restrictions on the numbers of minimum connections, maximum connections and idle connections to optimize the performance of pooling in specific problem contexts and environments.

Database support[edit]

Connection pooling is supported by IBM DB2,[1] Microsoft SQL Server,[2] Oracle,[3] MySQL,[4] and PostgreSQL.[5]

See also[edit]


  1. ^ IBM Connection Pooling Support
  2. ^ SQL Server Connection Pooling (ADO.NET)
  3. ^ OCI Driver Connection Pooling
  4. ^ MySQL Connection Pooling
  5. ^ PostgreSQL Replication, Clustering and Connection Pooling