Connection pooling options with JDBC: DBCP vs C3P0

前端 未结 16 1860
遥遥无期
遥遥无期 2020-11-22 06:17

What is the best connection pooling library available for Java/JDBC?

I\'m considering the 2 main candidates (free / open-source):

  • Apache DBCP - http:/
相关标签:
16条回答
  • 2020-11-22 07:07

    Unfortunately they are all out of date. DBCP has been updated a bit recently, the other two are 2-3 years old, with many outstanding bugs.

    0 讨论(0)
  • 2020-11-22 07:09

    For the auto-reconnect issue with DBCP, has any tried using the following 2 configuration parameters?

    validationQuery="Some Query"
    
    testOnBorrow=true
    
    0 讨论(0)
  • 2020-11-22 07:10

    I was having trouble with DBCP when the connections times out so I trialled c3p0. I was going to release this to production but then started performance testing. I found that c3p0 performed terribly. I couldn't configure it to perform well at all. I found it twice as slow as DBCP.

    I then tried the Tomcat connection pooling.

    This was twice as fast as c3p0 and fixed other issues I was having with DBCP. I spent a lot of time investigating and testing the 3 pools. My advice if you are deploying to Tomcat is to use the new Tomcat JDBC pool.

    0 讨论(0)
  • 2020-11-22 07:15

    Dbcp is production ready if configured properly.

    It is for example used on a commerce Website of 350000 visitors/ day and with pools of 200 connections.

    It handles very well timeouts provided you configure it correctly.

    Version 2 is on progress and it has a background which makes it reliable since Many Production problems have been tackled.

    We use it for our batch server solution and it has been running hundreds of batches That work on millions of lines in database.

    Performance tests run by tomcat jdbc pool show it has better performance than cp30.

    0 讨论(0)
提交回复
热议问题