C3P0 Connection pool detailed configuration.

Source: Internet
Author: User
Tags connection pooling reflection versions
<c3p0-config>
<default-config>
<!--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" >3</property>

<!--defines the number of repeated attempts to obtain a new connection from the database after a failure. Default:30--
<property name= "Acquireretryattempts" >30</property>

<!--the interval between two connections, in milliseconds. default:1000--
<property name= "Acquireretrydelay" >1000</property>

< All uncommitted actions are rolled back by default when the connection is closed!--. Default:false--
<property name= "Autocommitonclose" >false</property>

<!--C3P0 will build a blank table named Test and test it with its own query statement. If this parameter is defined, then
Property Preferredtestquery will be ignored. You cannot do anything on this test sheet, it will be for C3P0 testing only
Use. Default:null-->
<property name= "Automatictesttable" >Test</property>

<!--getting a connection failure will cause any thread that waits for the connection pool to get the connection to throw an exception. But the data source is still valid
Reserved and continue trying to get the connection the next time you call Getconnection (). If set to true, then try to
When a connection failure is obtained, the data source declares that it has been fractured and closed permanently. Default:false-->
<property name= "Breakafteracquirefailure" >false</property>

<!--the time when the client calls getconnection () after the connection pool has run out, and then throws
SQLException, if set to 0, waits indefinitely. Unit milliseconds. Default:0--
<property name= "Checkouttimeout" >100</property>

<!--test the connection by implementing a class of Connectiontester or Queryconnectiontester. The class name needs to be set to the full path.
Default:com.mchange.v2.c3p0.impl.defaultconnectiontester-->
<property name= "Connectiontesterclassname" ></property>

<!--Specify the path to the C3P0 libraries, if (as is often the case) you can get it locally without setting, default null
Default:null-->
<property name= "Factoryclasslocation" >null</property>

<!--strongly disrecommended. Setting this to true may leads to subtle and bizarre bugs.
Author strongly recommends not to use a property--
<property name= "Forceignoreunresolvedtransactions" >false</property>

<!--check for idle connections in all connection pools every 60 seconds. Default:0--
<property name= "Idleconnectiontestperiod" >60</property>

<!--get three connections when initializing, the value should be between Minpoolsize and Maxpoolsize. Default:3--
<property name= "Initialpoolsize" >3</property>

<!--maximum idle time, unused in 60 seconds, the connection is discarded. If 0, it will never be discarded. Default:0--
<property name= "MaxIdleTime" >60</property>

<!--The maximum number of connections that are kept in the connection pool. Default:15--
<property name= "Maxpoolsize" >15</property>

<!--the standard parameters of JDBC to control the number of preparedstatements loaded within the data source. But due to the statements of the pre-cache
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" >100</property>

<!--maxstatementsperconnection defines the maximum number of cache statements that a single connection in a connection pool has. Default:0--
<property name= "Maxstatementsperconnection" ></property>

<!--C3P0 is asynchronous, and slow JDBC operations are done through the help process. Extending these operations can effectively improve performance
Multiple operations are performed at the same time through multithreading. Default:3-->
<property name= "Numhelperthreads" >3</property>

<!--when a user calls getconnection () to make the root user the user who is going to get the connection. Primarily for connection pooling connections non-C3P0
Data source. Default:null-->
<property name= "Overridedefaultuser" >root</property>

<!--a parameter that corresponds to the Overridedefaultuser parameter. Default:null-->
<property name= "Overridedefaultpassword" >password</property>

<!--password. Default:null-->
<property name= "Password" ></property>

<!--define test statements that are executed by all connection tests. This one significantly improves the test speed in the case of connection testing. Attention:
The test table must exist at the time of the initial data source. Default:null-->
<property name= "preferredtestquery" >select ID from test where id=1</property>

<!--the user to wait up to 300 seconds before modifying the system configuration parameters. DEFAULT:300--
<property name= "Propertycycle" >300</property>

<!--use it only when you need it, due to its high performance consumption. If set to true then each connection commits the
Officer the validity of the test. It is recommended to use Idleconnectiontestperiod or automatictesttable
and other methods to improve the performance of the connection test. Default:false--
<property name= "Testconnectiononcheckout" >false</property>

<!--If set to true then officer the validity of the connection while the connection is made. Default:false--
<property name= "Testconnectiononcheckin" >true</property>

<!--user name. Default:null-->
<property name= "User" >root</property>

<!--earlier versions of C3P0 use dynamic reflection proxies for JDBC interfaces. In the case of a wide range of previous versions, this parameter
Allows the user to revert to the dynamic reflection agent to resolve an unstable failure. The newest non-reflection agent is faster and has started
Widely used, so this parameter may not be useful. Now the original dynamic reflection and the new non-reflection agent are
Supported, but possible future versions may not support dynamic reflection agents. Default:false-->
<property name= "Usestraditionalreflectiveproxies" >false</property>

<property name= "Automatictesttable" >con_test</property>
<property name= "Checkouttimeout" >30000</property>
<property name= "Idleconnectiontestperiod" >30</property>
<property name= "Initialpoolsize" >10</property>
<property name= "MaxIdleTime" >30</property>
<property name= "Maxpoolsize" >25</property>
<property name= "Minpoolsize" >10</property>
<property name= "Maxstatements" >0</property>
<user-overrides user= "Swaldman" >
</user-overrides>
</default-config>
<named-config name= "Dumbtestconfig" >
<property name= "Maxstatements" >200</property>
<user-overrides user= "Poop" >
<property name= "Maxstatements" >300</property>
</user-overrides>
</named-config>
</c3p0-config>

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.