开发者社区> 问答> 正文

关于dbcp配置的问题-dpcp报错

"

dbcp配置如下:

driverClassName=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/t_xx?autoReconnect=true&useUnicode=true&characterEncoding=utf8
username=root
password=123456

initialSize=2
maxActive=10
maxIdle=2
minIdle=1
maxWait=30000
removeAbandoned=true
removeAbandonedTimeout=180

但是按照这个配置部署项目时,报以下错误:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was40925 milliseconds ago.The last packet sent successfully to the server was 40925 milliseconds ago, which  is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

请问这个是配置方面的问题吗?如果是,应该如何配置呢?请指导哈...谢谢!

"

展开
收起
montos 2020-05-31 18:03:22 425 0
1 条回答
写回答
取消 提交回答
  • 注意连接池里连接的空闲时间应该小于 MySQL 配置里的 wait_timeout 的值

    ######

    maxWait=30000太大了?

    ######

    我试试看,谢谢了...

    2020-05-31 18:03:33
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载