public boolean isReadOnly(boolean useSessionStatus) throws SQLException {
  if (useSessionStatus && !this.isClosed && versionMeetsMinimum(5,6,5)&& !getUseLocalSessionState()&& getReadOnlyPropagatesToServer()) {
    java.sql.Statement stmt=null;
    java.sql.ResultSet rs=null;
    try {
      try {
        stmt=getMetadataSafeStatement();
        rs=stmt.executeQuery("select @@session.tx_read_only");
        if (rs.next()) {
          return rs.getInt(1) != 0;
        }
      }
 catch (      SQLException ex1) {
        if (ex1.getErrorCode() != MysqlErrorNumbers.ER_MUST_CHANGE_PASSWORD || getDisconnectOnExpiredPasswords()) {
          throw SQLError.createSQLException("Could not retrieve transation read-only status server",SQLError.SQL_STATE_GENERAL_ERROR,ex1,getExceptionInterceptor());
        }
      }
    }
  finally {
      if (rs != null) {
        try {
          rs.close();
        }
 catch (        Exception ex) {
        }
        rs=null;
      }
      if (stmt != null) {
        try {
          stmt.close();
        }
 catch (        Exception ex) {
        }
        stmt=null;
      }
    }
  }
  return this.readOnly;
}

public boolean isReadOnly ( boolean useSessionStatus ) throws SQLException { if ( useSessionStatus && ! this . isClosed && versionMeetsMinimum ( 5 , 6 , 5 ) && ! getUseLocalSessionState ( ) && getReadOnlyPropagatesToServer ( ) ) { java . sql . Statement stmt = null ; java . sql . ResultSet rs = null ; try { try { stmt = getMetadataSafeStatement ( ) ; rs = stmt . executeQuery ( "select @@session.tx_read_only" ) ; if ( rs . next ( ) ) { return rs . getInt ( 1 ) != 0 ; } } catch ( SQLException ex1 ) { if ( ex1 . getErrorCode ( ) != MysqlErrorNumbers . ER_MUST_CHANGE_PASSWORD || getDisconnectOnExpiredPasswords ( ) ) { throw SQLError . createSQLException ( "Could not retrieve transation read-only status server" , SQLError . SQL_STATE_GENERAL_ERROR , ex1 , getExceptionInterceptor ( ) ) ; } } } finally { if ( rs != null ) { try { rs . close ( ) ; } catch ( Exception ex ) { } rs = null ; } if ( stmt != null ) { try { stmt . close ( ) ; } catch ( Exception ex ) { } stmt = null ; } } } return this . readOnly ; }
tests to see if the connection is in read only mode . note that prior to 5 . 6 , we cannot really put the database in read only mode , but we pretend we can by returning the value of the readonly flag
