码迷,mamicode.com
首页 > 其他好文 > 详细

impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage isolation level is READ COMMITTED or READ UNCOMMITTED

时间:2020-02-24 19:01:21      阅读:86      评论:0      收藏:0      [点我收藏+]

标签:ola   nec   lin   一个   lob   least   require   java   level   

执行jdbc查询时抛出异常:

Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.

 

原因及解决方案

This is required by MySQL:

Statement based binlogging does not work in isolation level
READ UNCOMMITTED and READ COMMITTED since the necessary
locks cannot be taken.

根据tomcat抛异常,提示是事务级别在read committed和read uncommitted的时候binlog必须设置为row格式。

这个是java设置的一个局限性,java默认的事务级别是read committed,而mysql默认设置的binlog_format=statement。

将binlog_format设置为mixed

set global binlog_format=mixed;

过段时间,异常仍在!

设置成row

set global binlog_format=row;

问题解决!

或:

mysql> SET SESSION binlog_format = ‘ROW‘;

mysql> SET GLOBAL binlog_format = ‘ROW‘;

注意: 若手动修改linux下面/etc/my.cnf :  binlog_format = row  ,  需要重启mysql。

 

impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage isolation level is READ COMMITTED or READ UNCOMMITTED

标签:ola   nec   lin   一个   lob   least   require   java   level   

原文地址:https://www.cnblogs.com/wang-yaz/p/12357875.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!