Could not retrieve transation read-only status server

1、错误描述

Caused by: java.sql.SQLException: Could not retrieve transation read-only status server
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:870)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:902)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:892)
	at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3607)
	at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3576)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2107)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2077)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2062)
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2723)
	at com.alibaba.druid.filter.FilterAdapter.preparedStatement_executeUpdate(FilterAdapter.java:1069)
	at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeUpdate(FilterEventAdapter.java:491)
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2721)
	at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeUpdate(PreparedStatementProxyImpl.java:145)
	at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeUpdate(DruidPooledPreparedStatement.java:253)
	at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:916)
	at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:909)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
	... 30 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

2、错误原因

       在运行系统时,将MySQL数据库服务重新启动了一下,结果再次访问系统出现这个错误


3、解决办法

(1)关闭服务器再重启

(2)连接数据库的jar版本跟数据库不一致

你可能感兴趣的:(MySQL,Java)