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

Connection.setReadOnly has no effect

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.4, 2.6.0
    • Fix Version/s: 2.6.1
    • Component/s: pooling
    • Labels:
      None
    • Environment:
      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

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

              Dates

              Created:
              Updated:
              Resolved: