读书人

tomcat的数据库连接池(步骤二)

发布时间: 2012-11-18 10:51:21 作者: rapoo

tomcat的数据库连接池(方法二)


1.配置tomcat下的conf下的context.xml文件,在<context></context>之间添加连接池如下:
<Resource name="jdbc/mysql"
auth="Container"

type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/test"
username="root"
password="root"
maxActive="100"
maxIdle="30"
maxWait="10000" />


2.配置你的应用下的web.xml中的<web-app></web-app>之间加入:
xml 代码
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/mysqlx</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

读书人网 >其他数据库

热点推荐