tomcat jndi数据库连接池配置
tomcat 配置文件conf/content.xml
<content></content>里加入
<Resource name="jdbc/testdb" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="user" password="123456" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver" url="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=dbname" />
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" ><resource-ref><description>DB Connection</description><res-ref-name>jdbc/testdb</res-ref-name><res-type>com.microsoft.sqlserver.jdbc.SQLServerDriver</res-type><res-auth>Container</res-auth></resource-ref> </web-app>