C3p0 connection pool configuration data source

Source: Internet
Author: User
C3p0 connection pool Configuration
<C3p0-config> <default-config> <! -- The number of connections that c3p0 obtains at the same time when connections in the connection pool are exhausted. Default: 3 --> <property name = "acquireincrement"> 3 </property> <! -- Defines the number of repeated attempts after a new connection fails to be obtained from the database. Default: 30 --> <property name = "acquireretryattempts"> 30 </property> <! -- Interval between two connections, in milliseconds. Default: 1000 --> <property name = "acquireretrydelay"> 1000 </property> <! -- When the connection is closed, all uncommitted operations are rolled back by default. Default: false --> <property name = "autocommitonclose"> false </property> <! -- C3p0 creates an empty table named test and uses its own query statement for testing. If this parameter is defined, preferredtestquery is ignored. You cannot perform any operation on this test table. It will only be used for c3p0 testing. Default: NULL --> <property name = "automatictesttable"> test </property> <! -- Failed to obtain the connection will cause all threads waiting for the connection pool to obtain the connection to throw an exception. However, the data source is still valid, and the next call to getconnection () will continue to get the connection. If it is set to true, the data source will be declared disconnected and permanently closed after the connection fails to be obtained. Default: false --> <property name = "breakafteracquirefailure"> false </property> <! -- When the connection pool is used up, the client calls getconnection () and waits for the time to obtain the new connection. After the timeout, sqlexception will be thrown. If it is set to 0, the client waits indefinitely. Unit: milliseconds. Default: 0 --> <property name = "checkouttimeout"> 100 </property> <! -- Test the connection by implementing the connectiontester or queryconnectiontester class. The full path must be specified for the class name. Default: COM. mchange. v2.c3p0. impl. defaultconnectiontester --> <property name = "connectiontesterclassname"> </property> <! -- Specify the path of c3p0 libraries. If (usually like this) can be obtained locally, you do not need to set it. The default value is null and can be default: null --> <property name = "factoryclasslocation"> null </property> <! -- Stronugly disrecommended. setting this to true may lead to subtle and bizarre bugs. <property name = "forceignoreunresolvedtransactions"> false </property> <! -- Check all idle connections in the connection pool every 60 seconds. Default: 0 --> <property name = "idleconnectiontestperiod"> 60 </property> <! -- Three connections are obtained during initialization. The value must be between minpoolsize and maxpoolsize. Default: 3 --> <property name = "initialpoolsize"> 3 </property> <! -- Maximum idle time. connections are dropped if they are not used within 60 seconds. If it is 0, it will never be discarded. Default: 0 --> <property name = "maxidletime"> 60 </property> <! -- The maximum number of connections retained in the connection pool. Default: 15 --> <property name = "maxpoolsize"> 15 </property> <! -- JDBC standard parameter, used to control the number of preparedstatements loaded in the data source. However, the pre-cached statements belong to a single connection rather than the entire connection pool. Therefore, you need to consider many factors when setting this parameter. If both maxstatements and maxstatementsperconnection are 0, the cache is disabled. Default: 0 --> <property name = "maxstatements"> 100 </property> <! -- Maxstatementsperconnection defines the maximum number of statements cached for a single connection in the connection pool. Default: 0 --> <property name = "maxstatementsperconnection"> </property> <! -- C3p0 is asynchronous, and slow JDBC operations are completed by helping the process. These operations can effectively improve performance. Multiple operations can be executed simultaneously through multiple threads. Default: 3 --> <property name = "numhelperthreads"> 3 </property> <! -- When the user calls getconnection (), the root user becomes the user who gets the connection. It is mainly used when the connection pool is connected to a data source other than c3p0. Default: NULL --> <property name = "overridedefaultuser"> root </property> <! -- This parameter corresponds to the overridedefaultuser parameter. Default: NULL --> <property name = "overridedefaultpassword"> password </property> <! -- Password. Default: NULL --> <property name = "password"> </property> <! -- Define the test statement executed for all connection tests. This significantly increases the testing speed when connection tests are used. Note: The test table must exist at the initial data source. Default: NULL --> <property name = "preferredtestquery"> select ID from test where id = 1 </property> <! -- The user can wait up to 300 seconds before modifying system configuration parameters. Default: 300 --> <property name = "propertycycle"> 300 </property> <! -- Because of high performance consumption, use it only when needed. If it is set to true, the validity of each connection is verified when it is submitted. We recommend that you use idleconnectiontestperiod or automatictesttable to improve the connection test performance. Default: false --> <property name = "testconnectioncheckout"> false </property> <! -- If it is set to true, the connection validity will be verified when the connection is obtained. Default: false --> <property name = "testconnectiononcheckin"> true </property> <! -- User name. Default: NULL --> <property name = "user"> root </property> </c3p0-config>

 

Configuration in hibernate (Spring management:

<Bean id = "datasource" class = "com. mchange. v2.c3p0. combopooleddatasource "Destroy-method =" close "> <property name =" driverclass "> <value> oracle. JDBC. driver. oracledriver </value> </property> <property name = "jdbcurl"> <value> JDBC: oracle: thin: @ localhost: 1521: test </value> </property> <property name = "user"> <value> Kay </value> </property> <property name = "password"> <value> root </value> </property> <! -- The minimum number of connections retained in the connection pool. --> <Property name = "minpoolsize" value = "10"/> <! -- The maximum number of connections retained in the connection pool. Default: 15 --> <property name = "maxpoolsize" value = "100"/> <! -- Maximum idle time. connections are discarded if they are not used within 1800 seconds. If it is 0, it will never be discarded. Default: 0 --> <property name = "maxidletime" value = "1800"/> <! -- The number of connections that c3p0 obtains at the same time when connections in the connection pool are exhausted. Default: 3 --> <property name = "acquireincrement" value = "3"/> <property name = "maxstatements" value = "1000"/> <property name = "initialpoolsize" value = "10"/> <! -- Check all idle connections in the connection pool every 60 seconds. Default: 0 --> <property name = "idleconnectiontestperiod" value = "60"/> <! -- Defines the number of repeated attempts after a new connection fails to be obtained from the database. Default: 30 --> <property name = "acquireretryattempts" value = "30"/> <property name = "breakafteracquirefailure" value = "true"/> <property name = "testconnectioncheckout" value = ""false"/> </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.