共配置两个地方 web.xml与Tomcat中的conf/context.xml
1.web.xml
<resource-ref>
<description>DBConnection1</description>
res-ref-name>demo</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>DBConnection2</description>
<res-ref-name>jdbc/appdata2</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
或者
<init-param>
<param-name>dataSource</param-name>
<param-value>demo,oracle,GBK;cqqx,oracle,GBK</param-value>
</init-param>
2.context.xml
加多个
<Resource name="demo"
auth="Container"
type="javax.sql.DataSource"
maxActive="10"
maxIdle="30"
maxWait="10000"
username="gdqx"
password="password"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:workflow"
/>