应用程序用tomcat部署,每过一段时间,比方说有一个晚上应用程序没有被调用,然后一旦程序访问MySQL数据库,就会抛出异常:
java.sql.SQLException: Connection.close() has already been called. Invalid operation in this state
查了很多资料还是没有效果,只好采用了一个不是很推荐的方法:
给mysql更改8小时的过期时间:
wait_timeout=31536000
interactive_timeout=31536000
默认值是28800,既8小时,现在改成了1年,这样,到目前为止,还没有出现问题。
java.sql.SQLException: Connection.close() has already been called. Invalid operation in this state
查了很多资料还是没有效果,只好采用了一个不是很推荐的方法:
给mysql更改8小时的过期时间:
wait_timeout=31536000
interactive_timeout=31536000
默认值是28800,既8小时,现在改成了1年,这样,到目前为止,还没有出现问题。