1. Import the jar package:
Hibernate-release-4.3.5.final/lib/optional/*.jar
2. Add Configuration:
<!--configuring C3P0 data Source- <property name= "hibernate.c3p0.max_size" >10</property> <property Name= "Hibernate.c3p0.min_size" >5</property> <property name= "C3p0.acquire_increment" >2</ property> <property name= "C3p0.idle_test_period" >2000</property> <property name= " C3p0.timeout ">2000</property> <property name=" C3p0.max_statements ">10</property>
hibernate.c3p0.max_size: Maximum number of connections to the database connection pool
Hibernate.c3p0.min_size: Minimum number of connections to the database connection pool
Hibernate.c3p0.timeout: The Connection object in the database connection pool should be destroyed when it has not been used for a long time
Hibernate.c3p0.max_statements: Number of cached Statement objects
Hibernate.c3p0.idle_test_period: Indicates how long the connection pool is checking the thread to see if all the linked objects in the pool have timed out. The connection pool itself does not
Will remove itself from the connection pool, but instead dedicate a thread to do it at a certain time interval, the thread passes the last
The time difference between the times used and the current time to compare with timeout, and then decide whether to destroy the connection object.
Hibernate.c3p0.acquire_increment: How many database connections are acquired at the same time when a connection in the database connection pool is exhausted
Hibernate using C3P0 data sources