jsp使用mysql数据库连接池的方法
在conf目录中打开context.xml文件,并在文件写如下代码;
name = "jdbc/ConnectionPool"auth = "Container"
type = "javax.sql.DataSource"
password = "123456"
driverClassName = "com.mysql.jdbc.Driver"
maxIdle = "2"
maxWait = "5000"
username = "root"
url = "jdbc:mysql://localhost:3306/study?characterEncoding=GBK"
maxActive = "4"/>
Web-INF/web.xml
然后打开web.xml文件,在文件写入代码;
GuestBook
jdbc/ConnectionPool
javax.sql.DataSource
Container