What Is Database Connection Pool
This section provides a quick introduction on database connection pool, which is an object container managing a set of JDBC connection objects to be reused to avoid repeated connection opening and closing operations.
What Is Database Connection Pool? -
A Database Connection Pool is an object container that manages
a set of JDBC connection objects to be reused to avoid
repeated connection opening and closing operations.
There two main situations where you should consider using JDBC pooled connections:
- Open and close connections frequently -
A busy application server may need to handle thousands of requests in a short period of time.
And all requests need to use database connections to access application data.
- Complex database connections -
An application may need to connect to a remote database server passing through
multiple communication layers like: user authentications, security policies, firewalls,
virtual machines, proxies, load balancers, etc.
The JDBC API 3.0 and newer versions provide
a general interface for connection pooling with 3 primary classes:
- javax.sql.PooledConnection -
A physical connection to a data source.
- avax.sql.ConnectionPooledDataSource -
A factory for avax.sql.PooledConnection objects
- ConnectionEventListener -
An object to be notified of events generated by a PooledConnection object.
The actual implementation of the Connection Pool interface
will be done by JDBC drivers or third party libraries.
Commonly used third party Connection Pool libraries are:
Commons DBCP -
A JDBC database connection pool library developed by Apache
See Commons DBCP Website at
A mature and highly concurrent JDBC Connection pooling library
developed by Steve Waldman.
See C3P0 GitHub Website at
Table of Contents
About This Book
JDBC (Java Database Connectivity) Introduction
JDK (Java SE) Installation
Installing and Running Java DB - Derby
Derby (Java DB) JDBC Driver
Derby (Java DB) JDBC DataSource Objects
Java DB (Derby) - DML Statements
Java DB (Derby) - ResultSet Objects of Queries
Java DB (Derby) - PreparedStatement
Summary of JDBC Drivers and Database Servers
►Using Connection Pool with JDBC
►What Is Database Connection Pool
Commons DBCP for Connection Pooling
Connection Pooling with Commons DBCP BasicDataSource
Connection Pooling with Commons DBCP PoolingDriver
C3P0 for Connection Pooling
Connection Pooling with C3P0 ComboPooledDataSource
Connection Pooling with C3P0 DataSources
Full Version in PDF/EPUB