Spring Configuration C3PO

Source: Internet
Author: User

<bean id= "DataSource" class= "Com.mchange.v2.c3p0.ComboPooledDataSource" >
<!--Specify the drive to connect to the database
<property name= "Driverclass" value= "${jdbc.driverclassname}"/>
<!--specify url--> to connect to the database
<property name= "Jdbcurl" value= "${jdbc.url}"/>
<!--Specify the user name to connect to the database--
<property name= "user" value= "${jdbc.username}"/>
<!--specify a password to connect to the database--
<property name= "Password" value= "${jdbc.password}"/>
<property name= "maxpoolsize" value= "${jdbc.maxpoolsize}"/>
<property name= "minpoolsize" value= "${jdbc.minpoolsize}"/>
<!--the number of initialization connections for the specified connection pool should be between Minpoolsize and Maxpoolsize. Default:3-->
<property name= "initialpoolsize" value= "${jdbc.initialpoolsize}"/>
<!--maximum idle time, unused in 60 seconds, the connection is discarded. If 0, it will never be discarded. Default:0-->
<property name= "MaxIdleTime" value= "${jdbc.maxidletime}"/>
<!--c3p0 The number of connections that are fetched at the same time when the connection in the connection pool is exhausted. Default:3-->
<property name= "acquireincrement" value= "${jdbc.acquireincrement}"/>
<!--JDBC Standard to control the number of preparedstatements loaded within the data source However, because the pre-cached statements belong to a single connection instead of the entire connection pool, setting this parameter takes into account a number of factors. If both maxstatements and maxstatementsperconnection are 0, The cache is closed. Default:0-->
<property name= "maxstatements" value= "${jdbc.maxstatements}"/>
<!--check for idle connections in all connection pools every 60 seconds. Default:0--
<property name= "Idleconnectiontestperiod" value= "${jdbc.idleconnectiontestperiod}"/>

</bean>


Jdbc.driverclassname=com.mysql.jdbc.driver
jdbc.url=jdbc:mysql://x.x.x.x:3306/x
Jdbc.username=x
Jdbc.password=x
Jdbc.initialpoolsize=20
jdbc.maxpoolsize=100
jdbc.minpoolsize=10
jdbc.maxidletime=600
Jdbc.acquireincrement=5
Jdbc.maxstatements=5
Jdbc.idleconnectiontestperiod=60

Spring Configuration C3PO

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.