Disconnect automatic reconnection of c3p0,proxool,bonecp,druid and other connection pools

Source: Internet
Author: User
Tags time interval

The disconnection of the database connection pool, the failure recovery function is very important, do not know the current mainstream database connection pool: C3p0,proxool,bonecp,druid and so on support.

I know:

proxool: ?

1 2 3 4 5 6 7 8 9 10 <!--proxool resolves a problem with a database disconnect (Housekeepingtestsql is Oracle syntax, other databases are similar)--> < property name = "Housekeepingtestsql" > < value >select 1 dual</value > </Property > < property name = "Testbeforeuse" > < Value >true</value > </Property > < property name = "Testafteruse" > < value >true</VA Lue > </Property >

c3p0:

breakafteracquirefailure:false
        True indicates that pool is marked as block and close after a failed connection to the database, and that the client's request for pool is rejected even if the back-end database resumes normal and does not reconnect. False indicates that  pool is not marked as block, and the new request attempts to connection the database request. The default is False. Therefore, if you want the database and network to recover, pool can continue to request normal resources must set this configuration to false 
testconnectiononcheckout:false
         true means to test its validity every time a connection is checkout from the pool, this is a synchronous operation, so every database call on the application side tests its validity through test SQL, if the connection is not valid , the connection is closed and the pool is removed and an attempt is made to fetch another connection from the pool, which defaults to false, which is used with caution and can cause at least one more database call. &NBSP
testconnectiononcheckin:false
        True means that each time the connection is checkin into the pool, the validity is tested because it is an afterthought, so it is asynchronous, and the application does not have to wait for the test results, but it can also cause at least one more times of database calls. &NBSP
idleconnectiontestperiod:60
      &NBSP;C3P0 There will be a task to detect if the connection within the pool is normal. This parameter is the frequency at which the task runs. The default value is 0, which means no detection. &NBSP
acquireretryattempts:10
        retry times
acquireretrydelay:1000

Retry time interval

Feel disconnected automatic re-linked function performance, do not know if there is no better way to achieve.

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.