<Resource name="jdbc/MySQL" auth="Container" type="javax.sql.DataSource" maxActive="50" maxIdle="10" maxWait="10000" username="test" password="test" driverClassName="com.mysql.jdbc.Driver" removeAbandoned="true" removeAbandonedTimeout="200" logAbandoned="true" url="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8"/> 同时还得在工程的web.xml中加入: <resource-ref> <description>MySQL</description> <res-ref-name>jdbc/MySQL</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>