问题描述
这个spring配置,在使用过程中,基本上没插入200条数据后,通过mysql或netstat就可看到数据库连接达到10个,
并且mysql里面全部都是sleep状态。连接并没有释放,在等几十条后就出现异常。
dbcp配置
spring 注解事务
以下为stack信息
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, cause: Timeout waiting for idle object, cause: Timeout waiting for idle object
### The error may exist in configure/mybatis/User.xml
### The error may involve novel.Novel_read
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, cause: Timeout waiting for idle object, cause: Timeout waiting for idle