最近采用多线程使用JDBC连接数据库时,遇到如下问题,当连接次数达到一定次数后,就出现了如下错误提示
17:18:14,569 DEBUG BasicResourcePool:1831 - An exception occurred while acquiring a poolable resource. Will retry.
com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException
: Too many connections
at com.mysql.jdbc.SQLError.createSQLException(
SQLError.java:921
)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(
MysqlIO.java:2822
)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(
MysqlIO.java:777
)
at com.mysql.jdbc.MysqlIO.secureAuth411(
MysqlIO.java:3216
)
at com.mysql.jdbc.MysqlIO.doHandshake(
MysqlIO.java:1147
)