Using the C3P0 data source in Hibernate

Source: Internet
Author: User

1. Jar Package HIBERNATE-RELEASE-4.1.8.FINAL\LIB\OPTIONAL\C3P0

2. Join the configuration:

<!--database connection pool Maximum connections--
<property name= "C3p0.max_size" >30</property>
<!-- database connection pool minimum connections--
<property name= "C3p0.min_size" >2</property>
<!--How many database connections are acquired at the same time per request connection-
<property name= "C3p0.acquire_increment" >5</property>
<!--database connection pool When the connection object is not used for a long time, it should be destroyed--
<property name= "C3p0.timeout" >100</property>
<!--indicates how long the connection pool detection thread detects that all connections within a pool are timed out--
<property name= "C3p0.idle_test_period" >2000</property>

The connection pool itself does not remove itself from the connection pool, but rather has a thread that groups it at certain intervals.

This thread compares the time difference between the last time the connection object was used and the current one to timeout, and then decides to destroy the connection object.

<!-- The number of cache statement-

<property name= "C3p0.max_statements" >20</property>

Using the C3P0 data source in Hibernate

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.