9 Replies Latest reply on Jan 28, 2016 8:10 AM by Chandrasekaran Gautam

    Teiid JDBC setting the readonly flag throws an exception

    Chandrasekaran Gautam Newbie

      I am getting the following exception when setting the readonly flag on a Teiid jdbc connection-

      Call to method setReadOnly(true) not valid during a transaction

       

      On further investigation it was observed that the autocommit flag is false on the connection when the exception occurs.

      The following code in org.teiid.jdbc.ConnectionImpl is throwing the exception-

      public void setReadOnly(boolean readOnly) throws SQLException {

         if (this.readOnly == readOnly) {

         return;

        }

         // During transaction do not allow to change this flag
         if (!autoCommitFlag || this.transactionXid != null) {

         throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Invalid_During_Transaction", "setReadOnly(" + readOnly + ")"));//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
         }

         this.readOnly = readOnly;

      }

       

      Any reason autoCommit should be set to true for setting the readonly flag on the connection even when I have not started any transaction.