cp30连接池配置问题

来源:互联网 发布:云南进出口贸易数据 编辑:程序博客网 时间:2024/06/07 09:02

项目启动时一直报:

### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
### The error may exist in com/whty/manager/system/dao/CommonMapper.xml
### The error may involve commonMapper.getDataDictInfos
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.


上网查了好久,最后查到有人说吧maxStatements的值设为0就行,最后试了一下真的可以。


仔细看了一下自己的配置

jdbc.maxPoolSize=10

jdbc.maxStatements=30


应该就是这里的问题了,创建Statements对象的最大个数不能大于连接池的最大个数,否则就会因为连接池不够创建不了Statements对象而超时了。

最后maxStatements改成比maxPoolSize小的值就可以了。




0 0
原创粉丝点击