Hibernate using C3P0 data sources

Source: Internet
Author: User

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

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.