求MySql利用Tomcat实现数据库连接池的数据源配置文件?

来源:百度知道 编辑:UC知道 时间:2024/05/30 05:45:33
就是在Tomcat中server.xml文件中数据源的配置,还有在项目中的web.xml文件中的数据源的引用的配置.

server.xml中的配置
<Context docBase="XXX" path="/XXX" reloadable="true" source="com.ibm.wtp.web.server:XXX">
<Resource auth="Container"
driverClassName="com.mysql.jdbc.Driver" maxActive="10"
maxIdle="10" maxWait="-1"
name="jdbc/ifcp" password="123"
type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/XXX?charactorEncoding=utf8"
username="root"
removeAbondoned="true"
/>
</Context>
其中XXX是你的项目路径
web.xml好像不用特别的配置吧。如果需要可以加入下面的
<resource-ref>
<description>Mysql Datasource example</description>
<res-ref-name>jdbc/ifcp</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<r