71
votes

Which JDBC connection pool library should I use for a new application project (not web application)?

  • Apache DBCP has enough unresolved issues which are pushed until 2.0 I think.
  • C3P0 development seems to be stopped.
  • And both of them looks relatively slow.
  • Proxool is dead.
  • DBPool has almost no community (at least I've found no public one - no forums, no mailing lists...)
  • Apache Tomcat Pool looks to be unusable without Tomcat
  • I've found SQL Datasources article at Oracle website, but it seems, that it can be applied only to applets running in containers like servlets and web services.

Should I choose BoneCP may be? I don't have any huge requirements. I just need a good and easy to use database connection pool, that is in active development. Library, whose author can respond to bug reports, answer some specific question etc.

BTW, actually, I'm using MySQL only. I've found, that MySQL driver supports DriverManager interface, but I'm unsure if it actually pools connections or not.

4
Why does "Apache Tomcat Pool look to be unusable without Tomcat"? You can download it as a separate module. And as far as I understood it, it is intended to be used outside of Tomcat as well.a_horse_with_no_name
c3p0 has resurrected, and is pretty active atm (github.com/swaldman/c3p0)Aleksander Blomskøld
Tomcat's connection pool is definitely usable outside of Tomcat.matt b
Great list, just what I've been looking for. One contender is missing though: HikariCPSergei
@Sergei a good remark. Just note, that Hikari is just 6 months old. I hope very much, that this project will continue to mature and will be actively developed.Vladislav Rastrusny

4 Answers

42
votes

You've done good research. I'd say, go ahead with BoneCP. Some years ago I would have suggested c3p0, but it has currently some open and unresolved issues as well. Too bad, actually. The BoneCP author is by the way also active here at SO.

14
votes

It is possible use Tomcat Connection Pool without Tomcat, it is just a couple of .jars that you can include to any software. I have successfully used Tomcat Connection Pool with Resin and Jetty application servers.

10
votes

Another alternative is Vibur DBCP. This is a new, concurrent JDBC connection pool based on Java dynamic proxies. It is fast, has concise source code, supports fairness parameter, JDBC Statement caching, long running SQL queries logging, and many other features.

Vibur DBCP is available in the central Maven repo, the website shows the needed Maven dependency, various configuration examples (with Spring, Hibernate 3.x/4.x/5.x), and all configuration options.

Vibur DBCP requires Java 1.7.

Disclaimer: I'm the author of Vibur DBCP.

7
votes

I know its too late for answer but I just found an interesting link which has given a broader scope to answer most your queries. But at the end HikariCP and BoneCP are much better than other options.