Overview – Apache Commons DBCP
Apache Commons DBCP ™
Last Published: 11 Dec 2025
Version: 2.14.0
ApacheCon
Apache
Commons
Commons DBCP
About
Asking Questions
Release History
Issue Tracking
Dependency Management
Sources
Security
License
Code of Conduct
Javadoc
Javadoc Current
Javadoc 2.x Archive
Javadoc 1.x Archive
Configuration
Developers Guide
Examples
Downloads
Wiki
Project Documentation
Project Information
About
Summary
Team
Source Code Management
Issue Management
Mailing Lists
Maven Coordinates
Dependency Management
Dependencies
Dependency Convergence
CI Management
Distribution Management
Project Reports
Commons
License
Components
Sandbox
Dormant
General Information
Security
Volunteering
Contributing Patches
Building Components
Commons Parent POM
Commons Build Plugin
Commons Release Plugin
Site Publication
Releasing Components
Wiki
ASF
How the ASF works
Get Involved
Developer Resources
Code of Conduct
Sponsorship
Thanks
The DBCP Component
Many Apache projects support interaction with a relational database.
Creating a new connection for each user can be time consuming (often
requiring multiple seconds of clock time), in order to perform a database
transaction that might take milliseconds. Opening a connection per user
can be unfeasible in a publicly-hosted Internet application where the
number of simultaneous users can be very large. Accordingly, developers
often wish to share a "pool" of open connections between all of the
application's current users. The number of users actually performing
a request at any given time is usually a very small percentage of the
total number of active users, and during request processing is the only
time that a database connection is required. The application itself logs
into the DBMS, and handles any user account issues internally.
There are several Database Connection Pools already available, both
within Apache products and elsewhere. This Commons package provides an
opportunity to coordinate the efforts required to create and maintain an
efficient, feature-rich package under the ASF license.
The
commons-dbcp2
artifact relies on code in the
commons-pool2
artifact to provide the underlying object pool
mechanisms.
DBCP now comes in four different versions to support different versions of
JDBC. Here is how it works:
Developing
DBCP 2.5.0 and up compiles and runs under Java 8
JDBC 4.2
) and up.
DBCP 2.4.0 compiles and runs under Java 7
JDBC 4.1
) and above.
Running
DBCP 2.5.0 and up binaries should be used by applications running on Java 8 and up.
DBCP 2.4.0 binaries should be used by applications running under Java 7.
DBCP 2 is based on
Apache Commons Pool
and provides increased performance, JMX
support as well as numerous other new features compared to DBCP 1.x. Users
upgrading to 2.x should be aware that the Java package name has changed, as well
as the Maven co-ordinates, since DBCP 2.x is not binary compatible with DBCP
1.x. Users should also be aware that some configuration options (e.g. maxActive
to maxTotal) have been renamed to align them with the new names used by Commons
Pool.
Releases
See the
downloads
page for information on
obtaining releases.
Documentation
The
Javadoc API documents
are available online. In particular, you should
read the package overview of the
org.apache.commons.dbcp2
package for an overview of how to use DBCP.
There are
several examples
of using DBCP available.
Copyright © 2001-2025
The Apache Software Foundation
Apache Commons, Apache Commons DBCP, Apache, the Apache logo, and the Apache Commons project logos are trademarks of The Apache Software Foundation.
All other marks mentioned may be trademarks or registered trademarks of their respective owners.