Java error occurred while invoking MySQL data operation: Impossible to write to binary log since statement was in row format and Binlog_format = statement. '

Source: Internet
Author: User
Tags one table

persistent error using MySQL: Cannot execute statement:impossible to write to binary log since Binlog_form

ACTIVEMQ If you use MySQL InnoDB while the binlog is turned on, then in the ACK message, the log will be error: Java.sql.SQLException:Cannot EXECUTE statement: Binlogging impossible since Binlog_format = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging while transaction isolation level is read COMMITTED or READ uncommitted.

This is because the default MySQL Binlog_format is statement, and InnoDB can only be used by the Binlog_format in the Read committed or READ UNCOMMITTED isolation level is row.

In the ACTIVEMQ store JDBC Implementation (TransactionContext), in order to improve concurrency performance, the use of READ UNCOMMITTED:

//A cheap dirty level, we can live with
    1. Private int transactionisolation = connection.transaction_read_uncommitted;
     A cheap dirty level, we can live with         private int transactionisolation = Connection.transaction_read_uncommitte D
Therefore, the above problems will arise.

There are two solutions:

1, in MySQL set Binlog_format to row, at this time Binlog will increase, but generally to the data replication support better, recommended single-use high-performance environment.

2, in the Activemq.xml jdbcpersistenceadapter configuration transactionisolation= "4", that is, Transaction_repeatable_read, when the transaction is more stringent, will affect performance, It is recommended to use the cluster, strong real-time consistency, and no emphasis on single-machine performance.

You can see the instructions in the source code:

/** 
  1. * Set the Transaction isolation level to something other that transaction_read_uncommitted
  2. * This allowable dirty isolation level is not being achievable in clustered DB environments
  3. * So-a more restrictive and expensive-option may is needed like Transaction_repeatable_read
  4. * See Isolation Level constants in {@link java.sql.Connection}
  5. * @param transactionisolation the isolation level
  6. */
  7. public void settransactionisolation (int transactionisolation) {
  8. this.transactionisolation = transactionisolation;
  9. }
/**     * Set the Transaction isolation level to something other, transaction_read_uncommitted     * This allowable di Rty isolation level is not being achievable in clustered DB environments     * So a more restrictive and expensive option MA Y is needed like transaction_repeatable_read     * See Isolation Level constants in {@link java.sql.Connection}     * @par AM Transactionisolation the isolation level to use     *    /public void settransactionisolation (int transactionisolation) {        this.transactionisolation = transactionisolation;    }

Java error occurred while invoking MySQL data operation: Impossible to write to binary log since statement was in row format and Binlog_format = statement. '

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.