Geo*_*rge 3 java mysql spring database-connection jdbc
在我的网站(使用Spring 2.5和MySql)上不活动一段时间后,我收到以下错误:
org.springframework.dao.RecoverableDataAccessException: The last packet sent successfully to the server was 52,847,830 milliseconds ago. 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.
根据这个问题和链接的bug,我不应该只设置autoReconnect = true.这是否意味着我必须在我做的任何查询中捕获此异常,然后重试该事务?这个逻辑应该在数据访问层还是模型层?是否有一种简单的方法来处理这个而不是包装每个查询以捕获它?
归档时间: |
|
查看次数: |
11764 次 |
最近记录: |