Communications link failure during rollback (). Transaction resolution unknown.

今天运行程序的时候遇到异常如下所示:

 

2018-08-11 16:22:22 [DEBUG] [com.alibaba.druid.util.JdbcUtils] close connection error
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during rollback
(). Transaction resolution unknown.
    at sun.reflect.GeneratedConstructorAccessor30.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
    at com.mysql.jdbc.Util.getInstance(Util.java:387)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:917)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:896)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:885)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860)
    at com.mysql.jdbc.ConnectionImpl.rollback(ConnectionImpl.java:4602)
    at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4233)
    at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1531)
    at com.alibaba.druid.filter.FilterChainImpl.connection_close(FilterChainImpl.java:169)
    at com.alibaba.druid.filter.stat.StatFilter.connection_close(StatFilter.java:254)
    at com.alibaba.druid.filter.FilterChainImpl.connection_close(FilterChainImpl.java:165)
    at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.close(ConnectionProxyImpl.java:115)
    at com.alibaba.druid.util.JdbcUtils.close(JdbcUtils.java:83)
    at com.alibaba.druid.pool.DruidDataSource.shrink(DruidDataSource.java:2307)
    at com.alibaba.druid.pool.DruidDataSource$DestroyTask.run(DruidDataSource.java:2094)
    at com.alibaba.druid.pool.DruidDataSource$DestroyConnectionThread.run(DruidDataSource.java:2081)

 

后来找到了解决方法:

(1)mysql -uroot -p 先进入到MYSQL数据库

(2)mysql> show global variables like '%time%' ;

Communications link failure during rollback (). Transaction resolution unknown._第1张图片

(3)SET GLOBAL wait_timeout = 280000;

 

你可能感兴趣的:(数据库)