配置说明:
web.xml 中配置
<resource-ref> <description>Employees Database for HR Applications</description> <res-ref-name>jdbc/EmployeeDB</res-ref-name> <res-ref-type>javax.sql.DataSource</res-ref-type> <res-auth>Container</res-auth> </resource-ref>
res-ref-name/ |
资源的名称,相对于java:comp/env context |
对应的jabc连接池配置文件:
tomcatconfCatalinalocalhostemployer.xml
<?xml version="1.0" encoding="UTF-8"?> <Context docBase="E: omcatwebapps est" path="/test" reloadable="true"> <Resource name="jdbc/EmployeeDB" auth="Container" type="javax.sql.DataSource" maxActive="1000" maxIdle="30" maxWait="100" username="root" password="root" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/test?useUnicode=true"/> </Context>