JDBC的连接池选项:DBCP与C3P0

本文翻译自:Connection pooling options with JDBC: DBCP vs C3P0

What is the best connection pooling library available for Java/JDBC? 什么是可用于Java / JDBC的最佳连接池库?

I'm considering the 2 main candidates (free / open-source): 我正在考虑2个主要候选人(免费/开源):

I've read a lot about them in blogs and other forums but could not reach a decision. 我在博客和其他论坛上阅读了很多关于它们的内容,但无法做出决定。

Are there any relevant alternatives to these two? 这两个是否有任何相关的替代方案?


#1楼

参考:https://stackoom.com/question/2BQX/JDBC的连接池选项-DBCP与C-P


#2楼

Unfortunately they are all out of date. 不幸的是他们都已经过时了。 DBCP has been updated a bit recently, the other two are 2-3 years old, with many outstanding bugs. DBCP最近有所更新,另外两个是2-3岁,有许多突出的bug。


#3楼

I invite you to try out BoneCP -- it's free, open source, and faster than the available alternatives (see benchmark section). 我邀请您试用BoneCP - 它是免费的,开源的,并且比可用的替代品更快(参见基准测试部分)。

Disclaimer: I'm the author so you could say I'm biased :-) 免责声明:我是作者所以你可以说我有偏见:-)

UPDATE: As of March 2010, still around 35% faster than the new rewritten Apache DBCP ("tomcat jdbc") pool. 更新:截至2010年3月,仍然比新重写的Apache DBCP(“tomcat jdbc”)池快35%左右。 See dynamic benchmark link in benchmark section. 请参阅基准测试部分中的动态基准链

Update #2: (Dec '13) After 4 years at the top, there's now a much faster competitor : https://github.com/brettwooldridge/HikariCP 更新#2:(2013年12月)经过4年的顶峰,现在有一个更快的竞争对手: https//github.com/brettwooldridge/HikariCP

Update #3: (Sep '14) Please consider BoneCP to be deprecated at this point, recommend switching to HikariCP . 更新#3:( 2014年 9月)此时请考虑弃用 BoneCP,建议切换到HikariCP

Update #4: (April '15) -- I no longer own the domain jolbox.com, but the new owner has kept the old content so beware. 更新#4:(2015年4月) - 我不再拥有域名jolbox.com,但新所有者保留旧内容,请注意。


#4楼

Here are some articles that show that DBCP has significantly higher performance than C3P0 or Proxool. 以下是一些文章,表明DBCP的性能远远高于C3P0或Proxool。 Also in my own experience c3p0 does have some nice features, like prepared statement pooling and is more configurable than DBCP, but DBCP is plainly faster in any environment I have used it in. 另外根据我自己的经验,c3p0确实有一些很好的功能,比如预处理语句池,比DBCP更可配置,但DBCP在我使用它的任何环境中都明显更快。

Difference between dbcp and c3p0? dbcp和c3p0之间的区别? Absolutely nothing! 绝对没有! (A Sakai developers blog) http://blogs.nyu.edu/blogs/nrm216/sakaidelic/2007/12/difference_between_dbcp_and_c3.html (Sakai开发者博客) http://blogs.nyu.edu/blogs/nrm216/sakaidelic/2007/12/difference_between_dbcp_and_c3.html

See also the like to the JavaTech article "Connection Pool Showdown" in the comments on the blog post. 另请参阅博客文章评论中的JavaTech文章“连接池摊牌”。


#5楼

Just got done wasting a day and a half with DBCP. 刚刚用DBCP浪费了一天半的时间。 Even though I'm using the latest DBCP release, I ran into exactly the same problems as j pimmel did. 即使我使用的是最新的DBCP版本,我也遇到了与j pimmel完全相同的问题。 I would not recommend DBCP at all, especially it's knack of throwing connections out of the pool when the DB goes away, its inability to reconnect when the DB comes back and its inability to dynamically add connection objects back into the pool (it hangs forever on a post JDBCconnect I/O socket read) 我根本不推荐使用DBCP,特别是当数据库消失时,它无法将连接从池中抛出,当数据库恢复时无法重新连接,并且无法动态地将连接对象添加回池中(它永远挂起)一个后JDBCconnect I / O套接字读取)

I'm switching over to C3P0 now. 我现在切换到C3P0。 I've used that in previous projects and it worked and performed like a charm. 我在以前的项目中使用过它,它的工作和表现就像一个魅力。


#6楼

A good alternative which is easy to use is DBPool . DBPool是一个易于使用的好选择。

"A Java-based database connection pooling utility, supporting time-based expiry, statement caching, connection validation, and easy configuration using a pool manager." “基于Java的数据库连接池实用程序,支持基于时间的到期,语句缓存,连接验证以及使用池管理器轻松配置。”

http://www.snaq.net/java/DBPool/ http://www.snaq.net/java/DBPool/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章