Spring's configuration C3p0 instance

Source: Internet
Author: User

don't say anything, directly on the code:

<bean id= "DataSource" class= "Com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method= "Close" > <proper Ty name= "Driverclass" ><value>${jdbc.driverClassName}</value></property> <property name= "J Dbcurl "><value>${jdbc.url}</value></property> <property name=" user "><value>${ jdbc.username}</value></property> <property name= "password" ><value>${jdbc.password}<    /value></property> <!--The minimum number of connections that are kept in the connection pool. --<property name= "Minpoolsize" ><value>${jdbc.minPoolSize}</value></property> &L t;! --The maximum number of connections that are kept in the connection pool. Default:15--<property name= "Maxpoolsize" ><value>${jdbc.maxpoolsize}</value></prop Erty> <!--The number of connections obtained at initialization, the value should be between Minpoolsize and Maxpoolsize. Default:3--<property name= "Initialpoolsize" ><value>${jdbc.initialpoolsize}</value></property> <!--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}</value></proper Ty> <!--When the connection in the connection pool is exhausted c3p0 the number of connections that are fetched at the same time. Default:3--<property name= "Acquireincrement" ><value>${jdbc.acquireincrement}</value>& Lt;/property> <!--The standard parameters of JDBC 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.  So setting this parameter takes into account a variety of factors. If both maxstatements and maxstatementsperconnection are 0, the cache is closed. default:0--<property name= "Maxstatements" ><value>${jdbc.maxstatements}</value></ Property> <!--Check for idle connections in all connection pools every 60 seconds. default:0--<property name= "Idleconnectiontestperiod" > <value>${jdbc.idleconnectiontestpe Riod}</value></property> <!--defines the number of repeated attempts to obtain a new connection from the database after a failure. Default:30--<property name= "acquireretryattempts" &Gt;<value>${jdbc.acquireretryattempts}</value></property> <!--getting a connection failure will cause any thread that waits for the connection pool to get the connection to throw an XOR Often. However, the data source is still valid and continues to try to get the connection the next time you call Getconnection (). If set to True, the data source will declare broken and permanently shut down after attempting to acquire a connection failure. Default:false--<property name= "Breakafteracquirefailure" ><value>${jdbc.breakafteracquiref Ailure}</value></property> <!--because of the high performance consumption, please use it only when you need it. If set to true then the validity of each connection submission is officer. We recommend using methods such as Idleconnectiontestperiod or automatictesttable to improve the performance of your connectivity tests. Default:false--<property name= "Testconnectiononcheckout" ><value>${jdbc.testconnectiononc  Heckout}</value></property> </bean>


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.