rujingzhang 发表于 2013-1-13 19:00:28

Tomcat5.5配置多数据源

以Tomcat5.5:
(一)在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>
页: [1]
查看完整版本: Tomcat5.5配置多数据源