Spring C3P0 database Connection pool Connection configuration

Source: Internet
Author: User

The contents of the C3P0 connection pool configuration XML file are as follows:

C3P0 has richer configuration properties than DBCP, which allow for a variety of effective control over the data source:

Acquireincrement: When a connection in the connection pool is exhausted, C3P0 creates the number of new connections at once;

Acquireretryattempts: Defines the number of repeated attempts to obtain a new connection from the database after a failure, default is 30;

Acquireretrydelay: Two times the interval in the connection, in milliseconds, the default is 1000;

Autocommitonclose: All uncommitted operations are rolled back by default when the connection is closed. The default is false;

AUTOMATICTESTTABLE:C3P0 will build an empty table named Test and test it with its own query statement. If this parameter is defined, then the property preferredtestquery is ignored. You cannot take any action on this test table, it will be used in the C3P0 test, default is null;

Breakafteracquirefailure: Getting a connection failure will cause all threads waiting to get the connection to throw an exception. 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. The default is false;

Checkouttimeout: When the connection pool is exhausted, the client calls getconnection () to wait for a new connection, and then throws SqlException after the timeout, and waits indefinitely if set to 0. Unit milliseconds, default is 0;

Connectiontesterclassname: To test a connection by implementing a class of Connectiontester or Queryconnectiontester, the class name needs to be set to the fully qualified name. The default is Com.mchange.v2.C3P0.impl.DefaultConnectionTester;

Idleconnectiontestperiod: How many seconds to check the idle connection in all connection pools, the default is 0 means no check;

Initialpoolsize: The number of connections created at initialization should be taken between Minpoolsize and Maxpoolsize. The default is 3;

MaxIdleTime: Maximum idle time, the connection over idle time will be discarded. 0 or negative numbers will never be discarded. The default is 0;

Maxpoolsize: The maximum number of connections that are kept in the connection pool. The default is 15;

MAXSTATEMENTS:JDBC standard parameter to control the number of PreparedStatement loaded within the data source. However, because the pre-cached statement belong to a single connection instead of the entire connection pool. So setting this parameter takes many factors into account, and if both maxstatements and maxstatementsperconnection are 0, the cache is closed. The default is 0;

Maxstatementsperconnection: The maximum number of cache statement that a single connection in a connection pool has. The default is 0;

NUMHELPERTHREADS:C3P0 are asynchronous operations, and slow JDBC operations are done by helping the process. Extending these operations can effectively improve performance, and multiple operations are performed simultaneously through multithreading. The default is 3;

Preferredtestquery: Defines test statements that are executed by all connection tests. This parameter can significantly improve the test speed when using the connection test. The test table must exist at the time of the initial data source. default is null;

Propertycycle: The maximum number of seconds a user waits before modifying system configuration parameters. The default is 300;

Testconnectiononcheckout: Please use it only when you need it because of high performance consumption. If set to true then the validity of each connection submission is officer. It is recommended to use Idleconnectiontestperiod or automatictesttable

and other methods to improve the performance of the connection test. The default is false;

Testconnectiononcheckin: If set to true then the validity of the officer connection is obtained while the connection is made. The default is False.

Spring C3P0 database Connection pool Connection configuration

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.