Saturday, July 4, 2009

Database Connection Pooling: c3p0 versus dbcp

I was looking at database connection pooling the other day and was trying to decide between c3p0 and Apache Common's dbcp. Both are open source (of course) and implement the standard DataSource interface, which means that you can pretty much swap out one for the other without breaking functionality. Both are not very up-to-date with their last stable releases being over two years ago: The last stable release of dbcp (1.2.2) was 2007-04-04 while for c3p0 (0.9.1.2) was 2007-5-21. The consensus appears to say that dbcp is better for single threaded applications while c3p0 is better on multi-threaded applications (which would include your webapp). Based on this alone, I favor c3p0.

Reference:
Spring Forum posting
Javatech comparison of c3p0 versus dbcp
Stack Overflow discussion

2 comments:

  1. Try BoneCP (http://jolbox.com)

    According to the benchmarks it's faster than both .

    ReplyDelete