tomcat jndi连接mysql

在tomcat/context.xml中加入:

<WatchedResource>WEB-INF/web.xml</WatchedResource>

<!-- 加入这行 -->	
<Resource name="jdbc/wb" auth="Container"
        type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver"
        url="jdbc:mysql://localhost:3306/test"
        username="root" password="root" maxActive="20" maxIdle="10"
        maxWait="-1"/>

jdbc/wb可以自己随便取。

猜你喜欢

转载自vilight.iteye.com/blog/1851979