Cause: java.sql.SQLException: Could not retrieve transation read-only status ser

J2EE 码拜 9年前 (2015-04-20) 3330次浏览 0个评论

Exception in thread “main” org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: java.sql.SQLException: Could not retrieve transation read-only status server
### The error may involve zhao.ai.nan.dao.PersonDao.insert-Inline
### The error occurred while setting parameters
### SQL: insert into person(name,password) values(?,?)
### Cause: java.sql.SQLException: Could not retrieve transation read-only status server
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:147)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:134)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:79)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:40)
at $Proxy0.insert(Unknown Source)
at zhao.ai.nan.test.Main.main(Main.java:37)
Caused by: java.sql.SQLException: Could not retrieve transation read-only status server
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:951)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:941)
at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3936)
at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3907)
at com.mysql.jdbc.PreparedStatement.checkReadOnlySafeStatement(PreparedStatement.java:1258)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1278)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:41)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:66)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:45)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:108)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:145)
… 5 more
Caused by: java.sql.SQLException: Unknown system variable “”tx_read_only””
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4120)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4052)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2503)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2664)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2809)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2758)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1612)
at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3930)
… 14 more

Cause: java.sql.SQLException: Could not retrieve transation read-only status ser
20分
Unknown system variable “”tx_read_only””

配置文件呢

Cause: java.sql.SQLException: Could not retrieve transation read-only status ser
20分
应该是mysql数据库和你使用的数据库的驱动包的版本存在问题。换个驱动包版本试下
Cause: java.sql.SQLException: Could not retrieve transation read-only status ser
我也出现这个问题 java.sql.SQLException: Could not retrieve tr,是mysql数据库和你使用的数据库的驱动包的版本存在问题
Cause: java.sql.SQLException: Could not retrieve transation read-only status ser
把jar包的版本换了,就好了
Cause: java.sql.SQLException: Could not retrieve transation read-only status ser
以前为mysql-connector-java-5.1.28-bin.jar换成mysql-connector-java-5.1.8-bin.jar就好了

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明Cause: java.sql.SQLException: Could not retrieve transation read-only status ser
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!