zhang474089868
2016-05-17 09:12
采纳率: 50%
浏览 1.7k

myeclipse链接mysql数据库报错

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

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • 拿云之志 2016-05-17 09:26

    当数据库隔离级别为REPEATABLE-READ时,发布一个select语句也算是事物的开始,而且在hibernate里会把以select语句开头的事务标记为只读事务,此时在这个事务里再执行insert、update、delete等DML语句就会报错;
    解决办法:修改事务类型;
    如果没有用框架,在数据库执行 SET GLOBAL tx_isolation='READ-COMMITTED';
    如果使用框架,如Hibernate,可是使用配置。

    打赏 评论
  • Royal_lr 2016-05-17 09:53

    你这个的事务没有配好,select是只读的事务,其他的不是

    打赏 评论

相关推荐 更多相似问题