在tomact6下的context.xml中的<context></context>之间配置
<Resource name="jdbc/mysql"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/duty"
username="root"
password="root"
maxActive="100"
maxIdle="30"
maxWait="10000" />
在工程的web.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>