Solution:
数据库连接字符串加上
String url ="jdbc:mysql://192.168.1.10:3306/tdsdb?autoReconnect=true&failOverReadOnly=false";
!!!!!! [NOT WORK]
investigateseting the MySQL servervariable "wait_timeout" to a high value, rather than the default of 8 hours.
真正起作用的是:
INTERACTIVE_TIMEOUT instead ofWAIT_TIMEOUT
SELECTvariable_name,variable_value FROM information_schema.session_variables WHEREvariable_name LIKE '%timeout%'
或者:
SHOW GLOBAL VARIABLES LIKE'%timeout%'
修改MySQL的参数了,wait_timeout最大为31536000即1年,在my.cnf中加入:
[mysqld]
wait_timeout=31536000
interactive_timeout=31536000