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

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,可是使用配置。

    评论

报告相同问题?

悬赏问题

  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止
  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的