Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-786

Connection.setReadOnly has no effect

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 2.5.4, 2.6.0
    • 2.6.1
    • pooling
    • None
    • Ubuntu 18.04, 10.4.12-MariaDB-1:10.4.12+maria~bionic-log

    Description

      Wanted to create a read-only transaction using jConnector. Expect Mariadb to return a java.sql.SQLException when there is an update statement within a read only transaction

      See the code below.

      1. Mariadb commits the the statement and return success
      connection.setAutoCommit(false);
      connection.setReadOnly(true);
      – do an update statement
      connection.commit();

      2. Mariadb returns an exception, 'set transaction read only' is sent to Mariadb prior to starting an update statement.

      connection.createStatement().execute("set transaction read only")
      – do an update statement //Cause Mariadb to return a SqlException

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            chungonn Cheong Chung Onn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.