Results 1 to 6 of 6

Thread: c3p0 vs. dbcp

  1. #1
    Join Date
    Sep 2007
    Posts
    21

    Default c3p0 vs. dbcp

    Hello,

    Does anyone have any experience with either c3p0 vs. dbcp and know the pros and cons of each? The information that I've been able to find on google so far points me in the direction of c3p0. However, dbcp seems to have better support/documentation. So I'm not sure which is better.

    One thread says:
    These problems were experienced with the latest version of DBCP and
    pool. There are still some scary outstanding issues related to
    concurrency that are unresolved in DBCP's bugzilla:

    http://issues.apache.org/jira/browse/DBCP-44
    Evictor thread in GenericObjectPool has potential for deadlock

    Another says:
    "I personally prefer c3p0 mainly because it is actively maintained. There have been some discussions on each of them mainly on the Hibernate forums - try doing some search there. They are both open source though, so it is possible to extend/fix them if needed."

    I didn't have much luck searching the Hibernate mailing lists for the discussions, but I will keep looking. I am using the Spring framework and iBatis on top of a mysql database. Anyone have any suggestions comments on the pros/cons on these two packages?

    Thanks!
    Danny

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    I can't really say much about pros and cons. We used dbcp initially but had several problems, after reading various comments on other forums we tried out c3p0 and the issues went away. I've read a few posts on forums saying the same thing, but that's about as much as I have on the subject.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  3. #3

    Default Benchmarks and Blocking

    My experience has been that DBCP is likely to cause blocking and potential deadlocks in multithreaded environments with other synchronized resources. DBCP blocks on checkout and on checkin, C3P0 checks in asynchronously and avoids these sorts of issues.

    That being said, C3P0 needs a lot more connections to get the same job done and is, in general, a bit slower than DBCP. Here's an article I'm trying to find the time to finish which outlines some of this:

    Javatech: C3P0 vs DBCP - The Straight Dope

  4. #4
    Join Date
    Feb 2009
    Location
    London, UK
    Posts
    24

    Default An update

    While looking into how to configure the connection pool for an application that I have been working on (in Grails even), I was surprised/shocked to see a bunch of serious open issues related to DBCP.

    As a result, my team now uses c3p0.

    A couple of days after that decision was made I attended a SpringSource presentation on tcServer by Mark Thomas who mentioned in passing that SpringSource are developing a Tomcat connection pooling implementation:

    http://static.springsource.com/proje...cref.Help.html

    He also said that he has been contributing fixes to the open issues in DBCP - so some of the more serious issues could be going away soon.

    In the mean time I would avoid DBCP in production systems.

  5. #5

    Default Another link

    Just adding a link to another connection pool to try out (adding it here to complete this referenced thread): BoneCP

    (disclaimer: I'm the author)

  6. #6
    Join Date
    Nov 2009
    Posts
    1

    Default

    Quote Originally Posted by Darren Hicks View Post
    My experience has been that DBCP is likely to cause blocking and potential deadlocks in multithreaded environments with other synchronized resources. DBCP blocks on checkout and on checkin, C3P0 checks in asynchronously and avoids these sorts of issues.

    That being said, C3P0 needs a lot more connections to get the same job done and is, in general, a bit slower than DBCP. Here's an article I'm trying to find the time to finish which outlines some of this:

    Javatech: C3P0 vs DBCP - The Straight Dope
    I countered the same lock, but I found that it can be solved by increase count of maxactive property which default is 8 , too small to my application.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •