In web development, if a JSP, servlet, or EJB accesses a database directly using JDBC, every data access request must undergo such steps as establishing a database connection, opening a database, accessing a database, and shutting down a database connection, if such a database operation occurs frequently. The performance of the system is bound to drop sharply and even cause the system to crash. Database connection pooling technology is the most common method to solve this problem, which is basically provided in many application servers (for example: Weblogic,websphere,jboss).
The database connection pool is responsible for allocating, managing, and releasing connections to the database.
1. Database connection multiplexing. Reusing an existing database connection avoids the overhead of frequent connection creation and shutdown.
2. Unified connection Management. Free up database connections that have been idle for more than the maximum idle time, and avoid database connection leaks caused by not releasing database connections.
How connection pooling works: https://www.cnblogs.com/newpanderking/p/3875749.html
The common open source database connection pool is
1. C3P0 is an open source JDBC connection pool, which is published in the Lib directory with Hibernate, including statement objects for the connection and datasources pools that implement JDBC3 and JDBC2 extension specification descriptions.
2. BONECP is an open source, fast JDBC connection pool. BONECP is very small, only more than 40 K (runtime needs log4j and Google Collections support, which add up is not small), compared to c3p0 more than 600 K. Another person thinks that BONECP has a disadvantage is that the JDBC driver is loaded outside the connection pool, so that some application server configuration is not flexible. Of course, small volume is not bonecp excellent reason, BONECP in the end there is what prominent place, please see Performance test report.
3. DBCP (Database Connection pool) is a connection pool of databases that relies on the Jakarta Commons-pool object pooling mechanism, and Tomcat's data source uses DBCP. Currently, there are two versions of DBCP, 1.3 and 1.4, respectively. Version 1.3 corresponds to JDK 1.4-1.5 and JDBC 3, while the 1.4 version corresponds to JDK 1.6 and JDBC 4. So when choosing a version, look at what JDK version you're using, and there's no difference in functionality.
4.Proxool is a Java SQL driver driver that provides a connection pooling package for other types of drivers that you choose. Can be ported to existing code very simply. Fully configurable. Fast, mature and robust. You can transparently increase the connection pooling capability for your existing JDBC driver.
SQL Interview Grooming (1)--Database connection pool