日期:2014-05-16 浏览次数:20446 次
Hibernate3已经不再支持DBCP连接池,而推荐使用C-3PO
?
DBCP的bug非常多,因此Hibernate3已经不再支持DBCP连接池,而推荐使用C3PO。建议你更换数据库连接池。
然后跑去Hibernate官方论坛看,果然,在Please migrate away
from DBCP看到Gavin说:
引用:
Guys, after many problems with DBCP, I have decided to remove built-in
support for DBCP from Hibernate3, and deprecate DBCP in Hibernate 2.1.
I advise everyone to migrate away from DBCP to something that actually
works, like C3P0 or Proxool.
(If you /must/ use DBCP, you can always write your own connection
provider.)
Actually, it is probably about time we remove any remaining
dependencies to Apache commons stuff, since historically they have
caused just /so/ much trouble. The only Apache things that do seem to
work very well are Ant and log4j. Even commons-logging is a PIA,
especially in Tomcat.
C3P0是Hibernate3.0默认的自带数据库连接池,DBCP是Apache开发的数据库连接池。我们对这两种连接池进行压力测试对比,发现在并发30-0个用户以下时,DBCP比C3P0平均时间快1秒左右。但在并发400个用户时,两者差不多。
速度上虽然DBCP比C3P0快些,但是有BUG:当DBCP建立的数据库连接,因为某种原因断掉后,DBCP将不会再重新创建新的连接,导致必须重新启动To-mcat才能解决问题。DBCP的BUG使我们决定采用C3P0作为数据库连接池。
?