以Tomcat5.5:
(一)在apache-tomcat-5.5\conf的context.xml文件的<Context></Context>元素中:
(二)在web.xml中:
(一)在apache-tomcat-5.5\conf的context.xml文件的<Context></Context>元素中:
<Resource name="jdbc/mysql1" auth="Container" type="javax.sql.DataSource"
maxActive="50" maxIdle="30" maxWait="10000" logAbandoned="true"
username="root" password="123456" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/dbmy"/>
<Resource name="jdbc/mysql2" auth="Container" type="javax.sql.DataSource"
maxActive="50" maxIdle="30" maxWait="10000" logAbandoned="true"
username="root" password="123456" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/mydb"/> (二)在web.xml中:
<resource-ref>
<description>DB1 Connection</description>
<res-ref-name>jdbc/mysql1</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>DB2 Connection</description>
<res-ref-name>jdbc/mysql2</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Tomcat5.5配置MySQL数据源
本文介绍如何在Tomcat5.5中配置两个MySQL数据源,并在web.xml中进行引用。通过具体示例展示了如何设置数据源参数如连接数、超时等。
2677

被折叠的 条评论
为什么被折叠?



