tomcat-dbcp vs commons-dbcp [英] tomcat-dbcp vs commons-dbcp

查看:149
本文介绍了tomcat-dbcp vs commons-dbcp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这两个连接池库之间似乎存在很多混淆。我想知道哪一个更好(如果有的话)?

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 which I would like to put up... Could someone please verify?


  1. Tomcat DBCP:使用tomcat / lib目录中的默认tomcat-dbcp.jar。您需要web-inf / lib中的commons-dbcp.jar或commons-pool.jar库。数据库驱动程序应放在tomcat / lib中。

  1. Tomcat DBCP: uses the default tomcat-dbcp.jar which will be present in your tomcat/lib directory. You do not need commons-dbcp.jar or commons-pool.jar libraries in your web-inf/lib. The DB driver should be placed in tomcat/lib.

Tomcat DBCP数据源类是 org.apache.tomcat.dbcp.dbcp。的BasicDataSource
Commons DBCP数据源类是 org.apache.commons.dbcp.BasicDataSource

Tomcat DBCP datasource class is org.apache.tomcat.dbcp.dbcp.BasicDataSource. Commons DBCP datasource class is org.apache.commons.dbcp.BasicDataSource.

这两者之间的唯一区别可以在这个中找到博客。不知道信息是否正确。

The only difference between these two can be found in this blog. Do not know if the information is correct or not.

官方Tomcat文档清楚地提到大多数类都刚刚重新命名和重新打包。

The official Tomcat documentation mentions clearly that most classes have just been re-named and re-packaged.

所以问题是:使用哪一个哪个更好

推荐答案

Tomcat DBCP只是Apache Commons DBCP的重命名版本,也有一个不同的内部包名前缀。

Tomcat DBCP is just a renamed version of Apache Commons DBCP, with also a different internal package name prefix.

在构建时,Tomcat获取Commons DBCP来源(版本取决于Tomcat版本,例如Tomcat 7.0.27使用Commons DBCP 1.4),并且更换包名称( org.apache.commons - > org.apache.tomcat.dbcp )并将结果构建为 tomcat-dbcp.jar

At build time, Tomcat fetches the Commons DBCP sources (the version depends on the Tomcat version, for instance Tomcat 7.0.27 uses Commons DBCP 1.4), and does package name replacement (org.apache.commons -> org.apache.tomcat.dbcp) and builds the result as tomcat-dbcp.jar.

这样做是为了使内部Tomcat JDBC池永远不会与Commons DBCP cla的可能应用程序使用冲突小规模企业。这避免了许多潜在的类加载问题。

This is done so that the internal Tomcat JDBC pools never conflict with possible application uses of the Commons DBCP classes. This avoids many potential classloading issues.

编辑:dbcp软件包是关于数据源管理的。对于纯池实现,Commons DBCP依赖于Commons Pool(包 org.apache.commons.pool ),但在Tomcat中,池的实现被Tomcat自己的< a href =https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Introduction> JDBC池(包 org.apache.tomcat.jdbc .pool )。

The "dbcp" packages are about datasource management. For the pure pool implementation, Commons DBCP depends on Commons Pool (package org.apache.commons.pool), but in Tomcat the implementation of the pool is replaced with Tomcat's own JDBC pool (package org.apache.tomcat.jdbc.pool).

这篇关于tomcat-dbcp vs commons-dbcp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆