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/

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