tomcat-dbcp vs commons-dbcp

后端 未结 6 1122
耶瑟儿~
耶瑟儿~ 2020-12-02 06:05

It seems there is a lot of confusion between these two connection pooling libraries. What I want to know is which one is better (if at all)?

Here are some points whi

6条回答
  •  遥遥无期
    2020-12-02 06:30

    It seems there is a lot of confusion between these two connection pooling libraries. What I want to know is which one is better (if at all)?

    TL/DR: these are the same, don't use either of them.

    Tomcat-dbcp is the original re-package of apache commons pool included in Tomcat distribution. To avoid class clash package was renamed to org.apache.tomcat.dbcp.dbcp.*

    In Tomcat 7 (starting with 7.0.19 in July 2011) an additional connection pool was included in default Tomcat package (as part of tomcat-jdbc.jar) as alternative to stale apache commons implementation, called "The Tomcat JDBC Connection Pool":

    https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html

    This article covers the differences between the two:

    http://vigilbose.blogspot.com/2009/03/apache-commons-dbcp-and-tomcat-jdbc.html

    Short summary why new Tomcat pool is better:

    • actively supported
    • much smaller, easier to understand and maintain (if you care to look at source)
    • supports all commons-dbcp features + adds super useful ones like "initSQL", "validationInterval", "jdbcInterceptors" and more

提交回复
热议问题