C3p0 configuration in spring

Source: Internet
Author: User

<Bean id = "c3p0datasource" class = "com. mchange. v2.c3p0. combopooleddatasource" Destroy-method = "close">
<Property name = "driverclass">
<Value >$ {JDBC. driverclassname} </value>
</Property>
<Property name = "jdbcurl">
<Value >$ {JDBC. url} </value>
</Property>
<Property name = "user">
<Value >$ {JDBC. Username} </value>
</Property>
<Property name = "password">
<Value >$ {JDBC. Password} </value>
</Property>
<Property name = "initialpoolsize"> <value> 10 </value> </property>
<Property name = "minpoolsize"> <value> 5 </value> </property>
<Property name = "maxpoolsize"> <value> 30 </value> </property>
<Property name = "acquireincrement"> <value> 5 </value> </property>
<Property name = "maxidletime"> <value> 10 </value> </property>
<Property name = "maxstatements"> <value> 0 </value> </property>
</Bean>

The following parameters are the basic configuration parameters used:
Initialpoolsize:
Number of connections a pool will try to acquire upon startup. shocould be between minpoolsize and maxpoolsize
Number of links obtained during connection pool initialization, between minpoolsize and maxpoolsize

Minpoolsize:
Minimum number of connections a pool will maintain at any given time.
Minimum number of links

Maxpoolsize:
Maximum number of connections a pool will maintain at any given time.
Max connections

Acquireincrement:
Determines how many connections at a time c3p0 will try to acquire when the pool is exhausted.
The number of new connections obtained at a time when the current number of connections is exhausted

maxidletime:
seconds a connection can remain pooled but unused before being discarded. zero means idle connections never expire.
maximum idle time, in seconds. Useless links are recycled after they expire.

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.