C3P0 parameter explanation

Source: Internet
Author: User

#最常用配置
#Initialpoolsize: Number of connections created when connection pooling is initialized, Default:3, value should be between Minpoolsize and Maxpoolsize

c3p0.initialpoolsize=10

#Minpoolsize: The minimum number of connections maintained by the connection pool, Default:3

c3p0.minpoolsize=10

#Maxpoolsize: The maximum number of connections that are available in a connection pool, and if a new connection is made, the total number of connections exceeds this value no longer acquires new connections, but waits for other connections to be released, so this value may be designed to be large, default:15

C3p0.maxpoolsize=50

#acquireincrement: Connection pool The number of new database connections created one time when no idle connection is available, Default:3
C3p0.acquireincrement=5


#管理连接池的大小和连接的生存时间
#MaxIdleTime: The maximum idle time for a connection, and if a database connection is not used at this time, the connection will be disconnected. If it is 0, the connection is never disconnected, that is, the connection is reclaimed. default:0 Unit S

c3p0.maxidletime=600

#Idleconnectiontestperiod: Check for idle connections in all connection pools every 900 seconds
c3p0.idleconnectiontestperiod=900


#配置preparedstatement Cache
#连接池为数据源缓存的PreparedStatement的总数. Since PreparedStatement belong to a single connection, this number should be multiplied by the average number of connections in the application by the average of each connection PreparedStatement
#来计算. The maxstatementsperconnection configuration is not valid at the same time. Default:0 (not recommended)

c3p0.maxstatements=500

#连接池为数据源单个Connection缓存的PreparedStatement数, this configuration is more meaningful than maxstatements because the service object it caches is a single data connection.
#如果设置的好, it is certainly possible to improve performance. is not cached at 0. default:0 (see case study)
C3p0.maxstatementsperconnection=30


#重连相关配置
#Acquireretryattempts: The number of times the connection pool retries when a new connection fails, and if it is less than or equal to 0, retry indefinitely until the connection succeeds. DEFAULT:30 (recommended)

C3p0.acquireretryattempts=5

#Acquireretrydelay: The interval between two connections, in milliseconds, and when the connection pool is getting new connections. default:1000 Unit MS (recommended)

c3p0.acquireretrydelay=1000

#Breakafteracquirefailure: True if the data source is automatically closed when connection acquisition fails, unless the application is restarted. So generally not. Default:false (not recommended)

C3p0.breakafteracquirefailure=false

#Checkouttimeout: Configures the wait time for application getconnection when all connections to the connection pool are exhausted. 0 waits indefinitely until another connection is released or a new connection is created.
# not 0 when the time is up, if the connection is still not obtained, SqlException will be thrown.
is actually acquireretryattempts*acquireretrydelay. Default:0 (with two above, repeat, select two of them are OK)
c3p0.checkouttimeout=100


#其他
#Autocommitonclose: Whether the connection pool commits transactions automatically when the database connection is reclaimed. If False, the uncommitted transaction is rolled back, and if true, the transaction is automatically committed. Default:false (not recommended)

C3p0.autocommitonclose=false

#c3p0是异步操作的, slow JDBC operations are done through the help process. Extending these operations can effectively improve performance by implementing multiple operations at the same time through multithreading. Default:3
c3p0.numhelperthreads=10

C3p0 parameter explanation

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.