1.在Tomcat 5.5/conf/server.xml的<GlobalNamingResources>中添加:
<Resource name="JDBC for MySQL" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" password="" maxIdle="2" maxWait="5000" username="root" url="jdbc:mysql://localhost/test" maxActive="4"/>。
2.在Tomcat 5.5/webapps/test/WEB-INF/web.xml的<web-app>中添加:
<resource-ref>
<description>MySQL Connection Pool</description>
<res-ref-name>JDBC for MySQL</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
3.在Tomcat 5.5/conf/context.xml的<Context>中添加:
<ResourceLink name="JDBC for MySQL" global="JDBC for MySQL" type="javax.sql.DataSourcer"/>