DBCP Components Overview

Source: Internet
Author: User

Many Apache projects support interacting with relational databases. Creating a connection for each user is a very time-consuming task (typically, it takes a few seconds), and it can take a few milliseconds for the transaction to execute the database. For a publicly accessible Internet application, it is unrealistic to open a connection for each user, because at any one point there may be a large number of users who need access. As a result, developers want all current users to have access to the database using a shared pool of connections. In general, the percentage of users who request access at any time is small (relative to all active users), and the database connection is necessary only when the request is processed. The application then logs in to the DBMS and processes the user's needs internally.

Now there are several database connection pools available on the market for users to choose from, some of them Apache products, some not. The Commons package is the next feature-rich toolkit for ASF certificates, which is designed to balance the efficiency of creating and maintaining connections.

Package COMMONS-DBCP 2 requires the use of the underlying object pooling mechanism, which needs to be provided by package Commons-pool.

DBCP now has three different versions, each of which corresponds to a different version of JDBC. The following are their correspondence:

DBCP 2 can only be compiled and used under Java 7 (JDBC 4.1)

DBCP 1.4 can only be compiled and used in Java 6 (JDBC 4)

DBCP 1.3 can only be compiled and used in Java 1.4-5 (JDBC 3)

DBCP 2 is based on Commons Pool 2, and its support for JMX is better compared to the DBCP 1.x, and some new features have been added. If the user wants to upgrade to 2.x, be aware that the Java package name has changed, and Maven needs to adjust accordingly, should be DBCP 2.x and DBCP 1.x is incompatible. It should also be clear to the user that some of the configuration items (for example, maxactive to Maxtotal) have been renamed to match the name in Commons Pool 2.

DBCP 1.4.x and DBCP 1.3.x code base is no different, except those added to the JDBC 4 implementation method has been removed from the source code of DBCP 1.3.

This article translated from: http://commons.apache.org/proper/commons-dbcp/

DBCP Components Overview

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.