1.在$CATALINA_HOME/conf/server.XML中添加配置信息,聲明連接池的具體信息,添加內容如下:
factory
org.apache.commons.dbcp.BasicDataSourceFactory
maxWait
5000
maxActive
20
username
shopadm
passWord
123
url
jdbc:MySQL://localhost/shopdb?useUnicode=true&charact-erEncoding=gb2312
driverClassName
com.MySQL.jdbc.Driver
maxIdle
10
2. 在$CATALINA_HOME/conf/web.XML的前添加如下信息:
DB Connection
jdbc/MySQL
Javax.sql.DataSource
Container
…
…
factory
org.apache.commons.dbcp.BasicDataSourceFactory
maxWait
5000
maxActive
20
passWord
123
url
jdbc:MySQL://localhost/shopdb?useUnicode=true&characterEncoding=gb2312
driverClassName
com.MySQL.jdbc.Driver
maxIdle
10
username
shopadm
DB Connection jdbc/MySQL Javax.sql.DataSource Container