jsp使用mysql数据库连接池的方法
1.在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
2.然后打开web.xml文件,在文件写入代码;
GuestBook
jdbc/ConnectionPool
javax.sql.DataSource
Container
亿速云「云数据库 MySQL」免部署即开即用,比自行安装部署数据库高出1倍以上的性能,双节点冗余防止单节点故障,数据自动定期备份随时恢复。点击查看>>