code: public void setReadOnly(final boolean readOnly) throws SQLException {
      try {
        logger.debug("conn={}({}) - set read-only to value {} {}",
            protocol.getServerThreadId(),
            protocol.isMasterConnection() ? "M" : "S",
            readOnly);
        stateFlag |= ConnectionState.STATE_READ_ONLY;
        protocol.setReadonly(readOnly);
      } catch (SQLException e) {
        throw ExceptionMapper.getException(e, this, null, false);
      }
    }
docs: Sets whether this connection is read only.
  
  @param readOnly true if it should be read only.
  @throws SQLException if there is a problem