java.sql.SQLException: 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.
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是注意配置是否生效,本人測試比較難生效。