简体   繁体   中英

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.

C3P0 is very stable even if it is outdated and it's still very popular.

BoneCP seems to be performant but I've never used it in production. What is this problem between SLF4J and eclipse ? Never heard about it.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM