Esempio n. 1
0
  protected SQLException readError() throws SQLException {
    SQLException ex = null;
    int status = msg.readInt();
    String sqlState = msg.readString(5);
    byte type = msg.readByte();
    String message = msg.readString();

    switch (type) {
      case MSG_ET_ERR:
        if (trace.enabled(1))
          trace.write(
              tr_id
                  + ": Received error '"
                  + sqlState
                  + "' 0x"
                  + Integer.toHexString(status)
                  + " -- "
                  + message);

        ex = SqlExFactory.get(message, sqlState, status);
        break;

      case MSG_ET_WRN:
        if (trace.enabled(1))
          trace.write(
              tr_id
                  + ": Received warning '"
                  + sqlState
                  + "' 0x"
                  + Integer.toHexString(status)
                  + " -- "
                  + message);

        setWarning(new SqlWarn(message, sqlState, status));
        break;

      case MSG_ET_MSG:
        if (trace.enabled(3))
          trace.write(
              tr_id
                  + ": Received message '"
                  + sqlState
                  + "' 0x"
                  + Integer.toHexString(status)
                  + " -- "
                  + message);

        setWarning(new SqlWarn(message, sqlState, status));
        break;

      case MSG_ET_XA:
        if (trace.enabled(1)) trace.write(tr_id + ": Received XA error " + status);

        ex = new XaEx(status);
        break;
    }

    return (ex);
  } // readError
Esempio n. 2
0
  protected void readInfo() throws SQLException {
    while (msg.moreData()) {
      short param_id = msg.readShort();
      short param_len = msg.readShort();

      switch (param_id) {
        case MSG_IP_TRACE:
          {
            if (trace.enabled() || conn.dbms_log.enabled()) {
              String txt = msg.readString(param_len);
              trace.log("DBMS TRACE: " + txt);
              conn.dbms_log.write(txt);
            } else msg.skip(param_len);
            break;
          }

        default:
          if (trace.enabled(1)) trace.write(tr_id + ": Invalid info param ID " + param_id);
          throw SqlExFactory.get(ERR_GC4002_PROTOCOL_ERR);
      }
    }

    return;
  } // readInfo