Search code examples
javadatabasejdbcconnection-pooling

JDBC Connection Pool - Simple Setup and Library


This question has formed following a previous question (Implement Iterator design pattern using JDBC).

I understand the basic concepts of connection pooling but no further than that. My application requires a database that due to the requirements of implementing an iterator pattern i believe the database will need to be opened and closed frequently. Therefore a connection pool is required to prevent significant application lag. Preferably (and from my understanding is good practice) i would like the pool to open on application start up and shutdown when closed.

I have researched a number of connection pool library's such as BoneCP, DBPool, C3P0 and Proxool. I have seen others described in http://java-source.net/open-source/connection-pools but have not looked further than the basic description.

My question is which library has the easiest setup (for a simple database) that provides an efficient pooling.

BoneCP requires the SLF4J logging library which has problems with eclipse (Eclipse - Failed to load class "org.slf4j.impl.StaticLoggerBinder") which then creates a big problem for me. C3P0 has been labeled "outdated". Proxool seems simple but I'm not sure if this is efficient or if it fits the requirements.

Thank you.


Solution

  • I have used both DBCP Connection Pool and C3P0 . Both come up with good features however C3P0 has more configuration options than DBCP. I have not used BoneCP so not aware.

    You can use last stable build of C3P0 which I personally feel is simple to use and has more freedom than other pools.