Difference between C3P0 and DBCP

Difference between C3P0 and DBCP

 

      C3P0 is an open source JDBC connection pool, which implements data source and JNDI binding, and supports JDBC3 specification and JDBC2 standard extension. Currently, open source projects using it include Hibernate , Spring , etc.       DBCP (DataBase connection pool), database connection pool. It is a java connection pool project on apache and a connection pool component used by tomcat . Using dbcp alone requires 3 packages: common-dbcp.jar, common-pool.jar, common-collections.jar Since establishing a database connection is a very time-consuming and resource-consuming behavior, some connections are established with the database in advance through the connection pool. Put it in memory. When the application needs to establish a database connection, it can directly apply for one in the connection pool, and then put it back after use.       The difference between c3p0 and dbcp :       dbcp does not have the function of automatically reclaiming idle connections 

 

 

 

      c3p0 has the function of automatically recycling idle connections

 

      The main difference between the two is how they handle data connections! C3P0 provides the maximum idle time, and DBCP provides the maximum number of connections.

 

      In the former, when the connection exceeds the maximum idle connection time, the current connection will be disconnected. DBCP When the number of connections exceeds the maximum number of connections, all connections will be disconnected.

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326638848&siteId=291194637