Unknown system variable 'tx_read_only'
Could not retrieve transation read-only status server
--- The error occurred in sqlmaps/user/userSQL.xml. --- The error occurred while applying a parameter map. --- Check the user.login-InlineParameterMap. --- Check the statement (query failed). --- Cause: java.sql.SQLException: Could not retrieve transation read-only status server
SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [S1000]; error code [0]; --- The error occurred in sqlmaps/user/userSQL.xml. --- The error occurred while applying a parameter map. --- Check the user.login-InlineParameterMap. --- Check the statement (query failed). --- Cause: java.sql.SQLException: Could not retrieve transation read-only status server; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in sqlmaps/user/userSQL.xml. --- The error occurred while applying a parameter map. --- Check the user.login-InlineParameterMap. --- Check the statement (query failed). --- Cause: java.sql.SQLException: Could not retrieve transation read-only status server
myeclipse链接mysql数据库报错
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答
- 拿云之志 2016-05-17 09:26关注
当数据库隔离级别为REPEATABLE-READ时,发布一个select语句也算是事物的开始,而且在hibernate里会把以select语句开头的事务标记为只读事务,此时在这个事务里再执行insert、update、delete等DML语句就会报错;
解决办法:修改事务类型;
如果没有用框架,在数据库执行 SET GLOBAL tx_isolation='READ-COMMITTED';
如果使用框架,如Hibernate,可是使用配置。解决 无用评论 打赏 举报