Modified: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java
URL: 
http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java?rev=165585&r1=165584&r2=165585&view=diff
==============================================================================
--- 
incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java
 (original)
+++ 
incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java
 Sun May  1 23:25:59 2005
@@ -20,3352 +20,3262 @@
 
 package org.apache.derby.client.net;
 
-import org.apache.derby.client.am.SqlState;
-import org.apache.derby.client.am.SqlException;
-import org.apache.derby.client.am.DisconnectException;
+import javax.transaction.xa.Xid;
+
 import org.apache.derby.client.am.Connection;
 import org.apache.derby.client.am.ConnectionCallbackInterface;
-import org.apache.derby.client.am.Sqlca;    import javax.transaction.xa.*;
+import org.apache.derby.client.am.DisconnectException;
+import org.apache.derby.client.am.SqlException;
+import org.apache.derby.client.am.SqlState;
+import org.apache.derby.client.am.Sqlca;
 
 public class NetConnectionReply extends Reply
-                               implements ConnectionReplyInterface
-{
-  NetConnectionReply (NetAgent netAgent, int bufferSize)
-  {
-    super (netAgent, bufferSize);
-  }
-
-  // NET only entry point
-  void readExchangeServerAttributes (Connection connection) throws SqlException
-  {
-    startSameIdChainParse();
-    parseEXCSATreply((NetConnection) connection);
-    endOfSameIdChainData();
-    agent_.checkForChainBreakingException_();
-  }
-  void verifyDeferredReset () throws SqlException
-  {
-    readDssHeader();
-    verifyConnectReply(CodePoint.EXCSATRD);
-    readDssHeader();
-    verifyConnectReply(CodePoint.ACCSECRD);
-    readDssHeader();
-    verifyConnectReply(CodePoint.SECCHKRM);
-    readDssHeader();
-    verifyConnectReply(CodePoint.ACCRDBRM);
-    agent_.checkForChainBreakingException_();
-  }
-
-  void verifyConnectReply (int codept) throws SqlException
-  {
-    if (peekCodePoint() != codept) {
-      parseConnectError ();
-      return;
-    }
-    readLengthAndCodePoint();
-    skipBytes();
-
-    if (codept == CodePoint.ACCRDBRM) {
-      int peekCP = peekCodePoint();
-      if (peekCP == Reply.END_OF_SAME_ID_CHAIN)
-        return;
-
-      parseTypdefsOrMgrlvlovrs ();
-      NetSqlca netSqlca = parseSQLCARD (null);
-      netAgent_.netConnection_.completeSqlca (netSqlca);
-    }
-  }
-
-  void parseConnectError () throws DisconnectException
-  {
-    int peekCP = peekCodePoint();
-    switch (peekCP) {
-    case CodePoint.CMDCHKRM:
-      parseCMDCHKRM();
-      break;
-    case CodePoint.MGRLVLRM:
-      parseMGRLVLRM();
-      break;
-    default:
-      parseCommonError (peekCP);
-    }
-  }
-  void readDummyExchangeServerAttributes (Connection connection) throws 
SqlException
-  {
-    startSameIdChainParse();
-    parseDummyEXCSATreply((NetConnection) connection);
-    endOfSameIdChainData();
-    agent_.checkForChainBreakingException_();
-  }
-
-  // NET only entry point
-  void readAccessSecurity (Connection connection,
-                           int securityMechanism) throws SqlException
-  {
-    startSameIdChainParse();
-    parseACCSECreply((NetConnection) connection, securityMechanism);
-    endOfSameIdChainData();
-    agent_.checkForChainBreakingException_();
-  }
-
-  // NET only entry point
-  void readSecurityCheck (Connection connection) throws SqlException
-  {
-    startSameIdChainParse();
-    parseSECCHKreply((NetConnection) connection);
-    endOfSameIdChainData();
-    agent_.checkForChainBreakingException_();
-  }
-
-  // NET only entry point
-  void readAccessDatabase (Connection connection) throws SqlException
-  {
-    startSameIdChainParse();
-    parseACCRDBreply((NetConnection) connection);
-    endOfSameIdChainData();
-    agent_.checkForChainBreakingException_();
-  }
-
-
-  public void readCommitSubstitute (ConnectionCallbackInterface connection) 
throws DisconnectException
-  {
-    startSameIdChainParse();
-    parseDummyEXCSATreply ((NetConnection)connection); 
-    endOfSameIdChainData();
-  }
-
-  public void readLocalCommit (ConnectionCallbackInterface connection) throws 
DisconnectException
-  {
-    startSameIdChainParse();
-    parseRDBCMMreply (connection);
-    endOfSameIdChainData();
-  }
-
-  public void readLocalRollback (ConnectionCallbackInterface connection) 
throws DisconnectException
-  {
-    startSameIdChainParse();
-    parseRDBRLLBCKreply (connection);
-    endOfSameIdChainData();
-  }
-
-
-  public void readLocalXAStart (ConnectionCallbackInterface connection) throws 
DisconnectException
-  {
-  }
-
-  public void readLocalXACommit (ConnectionCallbackInterface connection) 
throws DisconnectException
-  {
-  }
-
-  public void readLocalXARollback (ConnectionCallbackInterface connection) 
throws DisconnectException
-  {
-  }
-
-
-  protected void readXaStartUnitOfWork(NetConnection conn) throws 
DisconnectException
-      {
-  }
-
-  protected int readXaEndUnitOfWork(NetConnection conn) throws 
DisconnectException
-  {
-    return 0;
-  }
-
-  protected int readXaPrepare(NetConnection conn) throws DisconnectException
-  {
-    return 0;
-    }
-
-  protected void readXaCommit(NetConnection conn) throws DisconnectException
-  {
-  }
-
-  protected int readXaRollback(NetConnection conn) throws DisconnectException
-  {
-    return 0;
-    }
-
-  protected void readXaRecover(NetConnection conn) throws DisconnectException
-  {
-  }
-
-  protected void readXaForget(NetConnection conn) throws DisconnectException
-  {
-  }
-
-
-  //------------------parse reply for specific 
command--------------------------
-  // These methods are "private protected", which is not a recognized java 
privilege,
-  // but means that these methods are private to this class and to subclasses,
-  // and should not be used as package-wide friendly methods.
-
-  // Parse the reply for the RDB Commit Unit of Work Command.
-  // This method handles the parsing of all command replies and reply data
-  // for the rdbcmm command.
-  private void parseRDBCMMreply (ConnectionCallbackInterface connection) 
throws DisconnectException
-  {
-    int peekCP = parseTypdefsOrMgrlvlovrs ();
-
-    if (peekCP != CodePoint.ENDUOWRM && peekCP != CodePoint.SQLCARD) {
-      parseCommitError (connection);
-      return;
-    }
-
-    if (peekCP == CodePoint.ENDUOWRM)
-    {
-    parseENDUOWRM (connection);
-    peekCP = parseTypdefsOrMgrlvlovrs ();
-    }
-
-    NetSqlca netSqlca = parseSQLCARD (null);
-    connection.completeSqlca (netSqlca);
-  }
-
-  // Parse the reply for the RDB Rollback Unit of Work Command.
-  // This method handles the parsing of all command replies and reply data
-  // for the rdbrllbck command.
-  private void parseRDBRLLBCKreply (ConnectionCallbackInterface connection) 
throws DisconnectException
-  {
-    int peekCP = parseTypdefsOrMgrlvlovrs ();
-    if (peekCP != CodePoint.ENDUOWRM) {
-      parseRollbackError ();
-      return;
-    }
-
-    parseENDUOWRM (connection);
-    peekCP = parseTypdefsOrMgrlvlovrs ();
-
-    NetSqlca netSqlca = parseSQLCARD (null);
-    connection.completeSqlca (netSqlca);
-  }
-
-  // Parse the reply for the Exchange Server Attributes Command.
-  // This method handles the parsing of all command replies and reply data
-  // for the excsat command.
-  private void parseEXCSATreply (NetConnection netConnection) throws 
DisconnectException
-  {
-    if (peekCodePoint() != CodePoint.EXCSATRD) {
-      parseExchangeServerAttributesError ();
-      return;
-    }
-    parseEXCSATRD (netConnection);
-  }
-
-  // Parse the reply for the Exchange Server Attributes Command (Dummy)
-  // This method handles the parsing of all command replies and reply data
-  // for the excsat command.
-  private void parseDummyEXCSATreply (NetConnection netConnection) throws 
DisconnectException
-  {
-    if (peekCodePoint() != CodePoint.EXCSATRD) {
-      parseExchangeServerAttributesError ();
-      return;
-    }
-    parseDummyEXCSATRD (netConnection);
-  }
-
-  // Parse the reply for the Access Security Command.
-  // This method handles the parsing of all command replies and reply data
-  // for the accsec command.
-  private void parseACCSECreply (NetConnection netConnection, int 
securityMechanism) throws DisconnectException
-  {
-    int peekCP = peekCodePoint();
-    if (peekCP != CodePoint.ACCSECRD) {
-      parseAccessSecurityError (netConnection);
-      return;
-    }
-    parseACCSECRD (netConnection, securityMechanism);
-
-    peekCP = peekCodePoint();
-    if (peekCP == Reply.END_OF_SAME_ID_CHAIN)
-      return;
-
-  }
-
-  // Parse the reply for the Security Check Command.
-  // This method handles the parsing of all command replies and reply data
-  // for the secchk command.
-  private void parseSECCHKreply (NetConnection netConnection) throws 
DisconnectException
-  {
-    if (peekCodePoint() != CodePoint.SECCHKRM) {
-      parseSecurityCheckError (netConnection);
-      return;
-    }
-
-    parseSECCHKRM (netConnection);
-    if (peekCodePoint() == CodePoint.SECTKN) {
-      // rpydta used only if the security mechanism returns
-      // a security token that must be sent back to the source system.
-      // this is only used for DCSSEC.  In the case of DCESEC,
-      // the sectkn must be returned as reply data if DCE is using
-      // mutual authentication.
-      // Need to double check what to map this to.  This is probably
-      // incorrect but consider it a conversation protocol error
-      // 0x03 - OBJDSS sent when not allowed.
-      //parseSECTKN (true);
-      boolean done = false;
-      byte[] bytes = parseSECTKN (false);
-    }
-  }
-
-  // Parse the reply for the Access RDB Command.
-  // This method handles the parsing of all command replies and reply data
-  // for the accrdb command.
-  private void parseACCRDBreply (NetConnection netConnection) throws 
DisconnectException
-  {
-    int peekCP = peekCodePoint();
-    if (peekCP != CodePoint.ACCRDBRM) {
-      parseAccessRdbError (netConnection);
-      return;
-    }
-
-    parseACCRDBRM (netConnection);
-    peekCP = peekCodePoint();
-    if (peekCP == Reply.END_OF_SAME_ID_CHAIN)
-      return;
-
-    parseTypdefsOrMgrlvlovrs ();
-    NetSqlca netSqlca = parseSQLCARD (null);
-    netConnection.completeSqlca (netSqlca);
-  }
-
-
-
-  protected int parseTypdefsOrMgrlvlovrs () throws DisconnectException
-  {
-    boolean targetTypedefCloned = false;
-    while (true) {
-      int peekCP = peekCodePoint();
-      if (peekCP == CodePoint.TYPDEFNAM) {
-        if (!targetTypedefCloned) {
-          netAgent_.targetTypdef_ = (Typdef) netAgent_.targetTypdef_.clone();
-          targetTypedefCloned = true;
-        }
-        parseTYPDEFNAM();
-      }
-      else if (peekCP == CodePoint.TYPDEFOVR) {
-        if (!targetTypedefCloned) {
-          netAgent_.targetTypdef_ = (Typdef) netAgent_.targetTypdef_.clone();
-          targetTypedefCloned = true;
-        }
-        parseTYPDEFOVR();
-      }
-      else
-        return peekCP;
-    }
-  }
-
-
-  //-----------------------------parse DDM Reply 
Messages-----------------------
-
-  protected void parseCommitError (ConnectionCallbackInterface connection) 
throws DisconnectException
-  {
-    int peekCP = peekCodePoint();
-    switch (peekCP) {
-    case CodePoint.ABNUOWRM:
-      NetSqlca sqlca = parseAbnormalEndUow (connection);
-      connection.completeSqlca (sqlca);
-      break;
-    case CodePoint.CMDCHKRM:
-      parseCMDCHKRM();
-      break;
-    case CodePoint.RDBNACRM:
-      parseRDBNACRM();
-      break;
-    default:
-      parseCommonError (peekCP);
-      break;
-    }
-  }
-
-  void parseRollbackError () throws DisconnectException
-  {
-    int peekCP = peekCodePoint();
-    switch (peekCP) {
-    case CodePoint.CMDCHKRM:
-      parseCMDCHKRM();
-      break;
-    case CodePoint.RDBNACRM:
-      parseRDBNACRM();
-      break;
-    default:
-      parseCommonError (peekCP);
-      break;
-    }
-  }
-
-  void parseExchangeServerAttributesError () throws DisconnectException
-  {
-    int peekCP = peekCodePoint();
-    switch (peekCP) {
-    case CodePoint.CMDCHKRM:
-      parseCMDCHKRM();
-      break;
-    case CodePoint.MGRLVLRM:
-      parseMGRLVLRM();
-      break;
-    default:
-      parseCommonError (peekCP);
-    }
-  }
-
-  void parseAccessSecurityError (NetConnection netConnection) throws 
DisconnectException
-  {
-    int peekCP = peekCodePoint();
-    switch (peekCP) {
-    case CodePoint.CMDCHKRM:
-      parseCMDCHKRM();
-      break;
-    case CodePoint.RDBNFNRM:
-      parseRDBNFNRM (netConnection);
-      break;
-    case CodePoint.RDBAFLRM:
-      parseRdbAccessFailed (netConnection);
-      break;
-    default:
-      parseCommonError (peekCP);
-    }
-  }
-
-  void parseSecurityCheckError (NetConnection netConnection) throws 
DisconnectException
-  {
-    int peekCP = peekCodePoint();
-    switch (peekCP) {
-    case CodePoint.CMDCHKRM:
-      parseCMDCHKRM();
-      break;
-    case CodePoint.OBJNSPRM:
-      parseOBJNSPRM();
-      break;
-    case CodePoint.RDBNFNRM:
-      parseRDBNFNRM (netConnection);
-      break;
-    case CodePoint.RDBAFLRM:
-      parseRdbAccessFailed (netConnection);
-      break;
-    default:
-      parseCommonError (peekCP);
-    }
-  }
-
-  void parseAccessRdbError (NetConnection netConnection) throws 
DisconnectException
-  {
-    int peekCP = peekCodePoint();
-    switch (peekCP) {
-    case CodePoint.CMDCHKRM:
-      parseCMDCHKRM();
-      break;
-    case CodePoint.RDBACCRM:
-      parseRDBACCRM();
-      break;
-    case CodePoint.RDBAFLRM:
-      parseRdbAccessFailed (netConnection);
-      break;
-    case CodePoint.RDBATHRM:
-      parseRDBATHRM (netConnection);
-      break;
-    case CodePoint.RDBNFNRM:
-      parseRDBNFNRM (netConnection);
-      break;
-    default:
-      parseCommonError (peekCP);
-    }
-  }
-
-
-  // Called by all the NET*Reply classes.
-  void parseCommonError (int peekCP) throws DisconnectException
-  {
-    switch (peekCP) {
-    case CodePoint.CMDNSPRM:
-      parseCMDNSPRM();
-      break;
-    case CodePoint.PRCCNVRM:
-      parsePRCCNVRM();
-      break;
-    case CodePoint.SYNTAXRM:
-      parseSYNTAXRM();
-      break;
-    case CodePoint.VALNSPRM:
-      parseVALNSPRM();
-      break;
-    default:
-      doObjnsprmSemantics (peekCP);
-    }
-  }
-
-  NetSqlca parseAbnormalEndUow (ConnectionCallbackInterface connection) throws 
DisconnectException
-  {
-    parseABNUOWRM (connection);
-    if (peekCodePoint() != CodePoint.SQLCARD)
-      parseTypdefsOrMgrlvlovrs();
-
-    NetSqlca netSqlca = parseSQLCARD (null);
-    return netSqlca;
-  }
-
-  void parseRdbAccessFailed (NetConnection netConnection) throws 
DisconnectException
-  {
-    parseRDBAFLRM();
-
-    // an SQLCARD is returned if an RDBALFRM is returned.
-    // this SQLCARD always follows the RDBALFRM.
-    // TYPDEFNAM and TYPDEFOVR are MTLINC
-
-    if (peekCodePoint() == CodePoint.TYPDEFNAM) {
-      parseTYPDEFNAM ();
-      parseTYPDEFOVR ();
-    }
-    else {
-      parseTYPDEFOVR ();
-      parseTYPDEFNAM ();
-    }
-
-    NetSqlca netSqlca = parseSQLCARD (null);
-    netConnection.completeSqlca (netSqlca);
-  }
-
-
-  // The Security Check (SECCHKRM) Reply Message indicates the acceptability
-  // of the security information.
-  // this method returns the security check code. it is up to the caller to 
check
-  // the value of this return code and take the appropriate action.
-  //
-  // Returned from Server:
-  // SVRCOD - required  (0 - INFO, 8 - ERROR, 16 -SEVERE)
-  // SECCHKCD - required
-  // SECTKN - optional, ignorable
-  // SVCERRNO - optional
-  private void parseSECCHKRM (NetConnection netConnection) throws 
DisconnectException
-  {
-    boolean svrcodReceived = false;
-    int svrcod = CodePoint.SVRCOD_INFO;
-    boolean secchkcdReceived = false;
-    int secchkcd = CodePoint.SECCHKCD_00;
-    boolean sectknReceived = false;
-    byte[] sectkn = null;
-
-    parseLengthAndMatchCodePoint (CodePoint.SECCHKRM);
-    pushLengthOnCollectionStack();
-    int peekCP = peekCodePoint();
-
-    while (peekCP != Reply.END_OF_COLLECTION) {
-
-      boolean foundInPass = false;
-
-      if (peekCP == CodePoint.SVRCOD) {
-        // severity code.  it's value is dictated by the SECCHKCD.
-        // right now it will not be checked that it is the correct value
-        // for the SECCHKCD.  maybe this will be done in the future.
-        foundInPass = true;
-        svrcodReceived = checkAndGetReceivedFlag (svrcodReceived);
-        svrcod = parseSVRCOD (CodePoint.SVRCOD_INFO, CodePoint.SVRCOD_SEVERE);
-        peekCP = peekCodePoint();
-      }
+        implements ConnectionReplyInterface {
+    NetConnectionReply(NetAgent netAgent, int bufferSize) {
+        super(netAgent, bufferSize);
+    }
+
+    // NET only entry point
+    void readExchangeServerAttributes(Connection connection) throws 
SqlException {
+        startSameIdChainParse();
+        parseEXCSATreply((NetConnection) connection);
+        endOfSameIdChainData();
+        agent_.checkForChainBreakingException_();
+    }
+
+    void verifyDeferredReset() throws SqlException {
+        readDssHeader();
+        verifyConnectReply(CodePoint.EXCSATRD);
+        readDssHeader();
+        verifyConnectReply(CodePoint.ACCSECRD);
+        readDssHeader();
+        verifyConnectReply(CodePoint.SECCHKRM);
+        readDssHeader();
+        verifyConnectReply(CodePoint.ACCRDBRM);
+        agent_.checkForChainBreakingException_();
+    }
+
+    void verifyConnectReply(int codept) throws SqlException {
+        if (peekCodePoint() != codept) {
+            parseConnectError();
+            return;
+        }
+        readLengthAndCodePoint();
+        skipBytes();
 
-      if (peekCP == CodePoint.SECCHKCD) {
-        // security check code. this specifies the state of the security 
information.
-        // there is a relationship between this value and the SVRCOD value.
-        // right now this driver will not check these values against each 
other.
-        foundInPass = true;
-        secchkcdReceived = checkAndGetReceivedFlag (secchkcdReceived);
-        secchkcd = parseSECCHKCD();
-        peekCP = peekCodePoint();
-      }
+        if (codept == CodePoint.ACCRDBRM) {
+            int peekCP = peekCodePoint();
+            if (peekCP == Reply.END_OF_SAME_ID_CHAIN) {
+                return;
+            }
+
+            parseTypdefsOrMgrlvlovrs();
+            NetSqlca netSqlca = parseSQLCARD(null);
+            netAgent_.netConnection_.completeSqlca(netSqlca);
+        }
+    }
 
-      if (peekCP == CodePoint.SECTKN) {
-        // security token.
-        // used when mutual authentication of the source and target servers
-        // is requested.  The architecture lists this as an instance variable
-        // and also says that the SECTKN flows as reply data to the secchk cmd 
and
-        // it must flow after the secchkrm message.  Right now this driver 
doesn't
-        // support ay mutual authentication so it will be ignored (it is listed
-        // as an ignorable instance variable in the ddm manual).
-        foundInPass = true;
-        sectknReceived = checkAndGetReceivedFlag (sectknReceived);
-        sectkn = parseSECTKN (true);
-        peekCP = peekCodePoint();
-      }
+    void parseConnectError() throws DisconnectException {
+        int peekCP = peekCodePoint();
+        switch (peekCP) {
+        case CodePoint.CMDCHKRM:
+            parseCMDCHKRM();
+            break;
+        case CodePoint.MGRLVLRM:
+            parseMGRLVLRM();
+            break;
+        default:
+            parseCommonError(peekCP);
+        }
+    }
 
-      if (!foundInPass)
-        doPrmnsprmSemantics (peekCP);
+    void readDummyExchangeServerAttributes(Connection connection) throws 
SqlException {
+        startSameIdChainParse();
+        parseDummyEXCSATreply((NetConnection) connection);
+        endOfSameIdChainData();
+        agent_.checkForChainBreakingException_();
+    }
 
+    // NET only entry point
+    void readAccessSecurity(Connection connection,
+                            int securityMechanism) throws SqlException {
+        startSameIdChainParse();
+        parseACCSECreply((NetConnection) connection, securityMechanism);
+        endOfSameIdChainData();
+        agent_.checkForChainBreakingException_();
     }
-    popCollectionStack();
-    // check for the required instance variables.
-    checkRequiredObjects (svrcodReceived, secchkcdReceived);
-
-    netConnection.securityCheckComplete (svrcod, secchkcd);
-  }
-
-
-  // Access to RDB Completed (ACRDBRM) Reply Message specifies that an
-  // instance of the SQL application manager has been created and is bound
-  // to the specified relation database (RDB).
-  //
-  // Returned from Server:
-  // SVRCOD - required  (0 - INFO, 4 - WARNING)
-  // PRDID - required
-  // TYPDEFNAM - required (MINLVL 4) (QTDSQLJVM)
-  // TYPDEFOVR - required
-  // RDBINTTKN - optional
-  // CRRTKN - optional
-  // USRID - optional
-  // SRVLST - optional (MINLVL 5)
-  private void parseACCRDBRM (NetConnection netConnection) throws 
DisconnectException
-  {
-    boolean svrcodReceived = false;
-    int svrcod = CodePoint.SVRCOD_INFO;
-    boolean prdidReceived = false;
-    String prdid = null;
-    boolean typdefnamReceived = false;
-    boolean typdefovrReceived = false;
-    boolean rdbinttknReceived = false;
-    boolean crrtknReceived = false;
-    byte[] crrtkn = null;
-    boolean usridReceived = false;
-    String usrid = null;
-
-    parseLengthAndMatchCodePoint (CodePoint.ACCRDBRM);
-    pushLengthOnCollectionStack();
-    int peekCP = peekCodePoint();
-
-    while (peekCP != Reply.END_OF_COLLECTION) {
-
-      boolean foundInPass = false;
-
-      if (peekCP == CodePoint.SVRCOD) {
-        // severity code.  If the target SQLAM cannot support the typdefovr
-        // parameter values specified for the double-byte and mixed-byte CCSIDs
-        // on the corresponding ACCRDB command, then the severity code WARNING
-        // is specified on the ACCRDBRM.
-        foundInPass = true;
-        svrcodReceived = checkAndGetReceivedFlag (svrcodReceived);
-        svrcod = parseSVRCOD (CodePoint.SVRCOD_INFO, CodePoint.SVRCOD_WARNING);
-        peekCP = peekCodePoint();
-      }
 
-        // this is the product release level of the target RDB server.
-      if (peekCP == CodePoint.PRDID) {
-        foundInPass = true;
-        prdidReceived = checkAndGetReceivedFlag (prdidReceived);
-        prdid = parsePRDID (false); // false means do not skip the bytes
-        peekCP = peekCodePoint();
-      }
+    // NET only entry point
+    void readSecurityCheck(Connection connection) throws SqlException {
+        startSameIdChainParse();
+        parseSECCHKreply((NetConnection) connection);
+        endOfSameIdChainData();
+        agent_.checkForChainBreakingException_();
+    }
 
-      if (peekCP == CodePoint.TYPDEFNAM) {
-        // this is the name of the data type to the data representation mapping
-        // definitions tha the target SQLAM uses when sending reply data 
objects.
-        foundInPass = true;
-        typdefnamReceived = checkAndGetReceivedFlag (typdefnamReceived);
-        parseTYPDEFNAM();
-        peekCP = peekCodePoint();
-      }
+    // NET only entry point
+    void readAccessDatabase(Connection connection) throws SqlException {
+        startSameIdChainParse();
+        parseACCRDBreply((NetConnection) connection);
+        endOfSameIdChainData();
+        agent_.checkForChainBreakingException_();
+    }
 
-      if (peekCP == CodePoint.TYPDEFOVR) {
-        // this is the single-byte, double-byte, and mixed-byte CCSIDs of the
-        // scalar data arrays (SDA) in the identified data type to data 
representation
-        // mapping definitions.
-        foundInPass = true;
-        typdefovrReceived = checkAndGetReceivedFlag (typdefovrReceived);
-        parseTYPDEFOVR();
-        peekCP = peekCodePoint();
-      }
 
+    public void readCommitSubstitute(ConnectionCallbackInterface connection) 
throws DisconnectException {
+        startSameIdChainParse();
+        parseDummyEXCSATreply((NetConnection) connection);
+        endOfSameIdChainData();
+    }
 
+    public void readLocalCommit(ConnectionCallbackInterface connection) throws 
DisconnectException {
+        startSameIdChainParse();
+        parseRDBCMMreply(connection);
+        endOfSameIdChainData();
+    }
 
-      if (peekCP == CodePoint.USRID) {
-        // specifies the target defined user ID.  It is returned if the value 
of
-        // TRGDFTRT is TRUE in ACCRDB.  Right now this driver always sets this
-        // value to false so this should never get returned here.
-        // if it is returned, it could be considered an error but for now
-        // this driver will just skip the bytes.
-        foundInPass = true;
-        usridReceived = checkAndGetReceivedFlag (usridReceived);
-        usrid = parseUSRID (true);
-        peekCP = peekCodePoint();
-      }
+    public void readLocalRollback(ConnectionCallbackInterface connection) 
throws DisconnectException {
+        startSameIdChainParse();
+        parseRDBRLLBCKreply(connection);
+        endOfSameIdChainData();
+    }
 
-      if (peekCP == CodePoint.CRRTKN) {
-        // carries information to correlate with the work being done on bahalf
-        // of an application at the source and at the target server.
-        // defualt value is ''.
-        // this parameter is only retunred if an only if the CRRTKN parameter
-        // is not received on ACCRDB.  We will rely on server to send us this
-        // in ACCRDBRM
-        foundInPass = true;
-        crrtknReceived = checkAndGetReceivedFlag (crrtknReceived);
-        crrtkn = parseCRRTKN (false);
-        peekCP = peekCodePoint();
-      }
 
+    public void readLocalXAStart(ConnectionCallbackInterface connection) 
throws DisconnectException {
+    }
 
-      if (!foundInPass)
-        doPrmnsprmSemantics (peekCP);
+    public void readLocalXACommit(ConnectionCallbackInterface connection) 
throws DisconnectException {
     }
-    popCollectionStack();
-    // check for the required instance variables.
-    checkRequiredObjects (svrcodReceived,
-                          prdidReceived,
-                          typdefnamReceived,
-                          typdefovrReceived);
-
-    netConnection.rdbAccessed(svrcod,
-                             prdid,
-                             crrtknReceived,
-                             crrtkn);
-  }
 
+    public void readLocalXARollback(ConnectionCallbackInterface connection) 
throws DisconnectException {
+    }
 
 
-  // The End Unit of Work Condition (ENDUOWRM) Reply Mesage specifies
-  // that the unit of work has ended as a result of the last command.
-  //
-  // Returned from Server:
-  //   SVRCOD - required  (4 WARNING)
-  //   UOWDSP - required
-  //   RDBNAM - optional
-  void parseENDUOWRM (ConnectionCallbackInterface connection) throws 
DisconnectException
-  {
-    boolean svrcodReceived = false;
-    int svrcod = CodePoint.SVRCOD_INFO;
-    boolean uowdspReceived = false;
-    int uowdsp = 0;
-    boolean rdbnamReceived = false;
-    String rdbnam = null;
-
-    parseLengthAndMatchCodePoint (CodePoint.ENDUOWRM);
-    pushLengthOnCollectionStack();
-    int peekCP = peekCodePoint();
-
-    while (peekCP != Reply.END_OF_COLLECTION) {
-
-      boolean foundInPass = false;
-
-      if (peekCP == CodePoint.SVRCOD) {
-        foundInPass = true;
-        svrcodReceived = checkAndGetReceivedFlag (svrcodReceived);
-        svrcod = parseSVRCOD (CodePoint.SVRCOD_WARNING, 
CodePoint.SVRCOD_WARNING);
-        peekCP = peekCodePoint();
-      }
+    protected void readXaStartUnitOfWork(NetConnection conn) throws 
DisconnectException {
+    }
 
-      if (peekCP == CodePoint.UOWDSP) {
-        foundInPass = true;
-        uowdspReceived = checkAndGetReceivedFlag (uowdspReceived);
-        uowdsp = parseUOWDSP();
-        peekCP = peekCodePoint();
-      }
+    protected int readXaEndUnitOfWork(NetConnection conn) throws 
DisconnectException {
+        return 0;
+    }
 
-      if (peekCP == CodePoint.RDBNAM) {
-        foundInPass = true;
-        rdbnamReceived = checkAndGetReceivedFlag (rdbnamReceived);
-        rdbnam = parseRDBNAM (true);
-        peekCP = peekCodePoint();
-      }
+    protected int readXaPrepare(NetConnection conn) throws DisconnectException 
{
+        return 0;
+    }
 
+    protected void readXaCommit(NetConnection conn) throws DisconnectException 
{
+    }
 
-      if (!foundInPass)
-        doPrmnsprmSemantics (peekCP);
+    protected int readXaRollback(NetConnection conn) throws 
DisconnectException {
+        return 0;
     }
-    popCollectionStack();
-    checkRequiredObjects (svrcodReceived, uowdspReceived);
 
-    netAgent_.setSvrcod (svrcod);
-    if (uowdsp == CodePoint.UOWDSP_COMMIT)
-      connection.completeLocalCommit();
-    else
-      connection.completeLocalRollback();
-  }
-
-  // Command Check Reply Message indicates that the requested
-  // command encountered an unarchitected and implementation-specific
-  // condition for which there is no architected message.  If the severity
-  // code value is ERROR or greater, the command has failed.  The
-  // message can be accompanied by other messages that help to identify
-  // the specific condition.
-  // The CMDCHKRM should not be used as a general catch-all in place of
-  // product-defined messages when using product extensions to DDM.
-  // PROTOCOL architects the SQLSTATE value depending on SVRCOD
-  // SVRCOD 0 -> SQLSTATE is not returned
-  // SVRCOD 8 -> SQLSTATE of 58008 or 58009
-  // SVRCOD 16,32,64,128 -> SQLSTATE of 58009
-  //
-  // Messages
-  //   SQLSTATE : 58009
-  //     Execution failed due to a distribution protocol error that caused 
deallocation of the conversation.
-  //     SQLCODE : -30020
-  //     Execution failed because of a Distributed Protocol
-  //       Error that will affect the successful execution of subsequent
-  //       commands and SQL statements: Reason Code <reason-code>.
-  //     Some possible reason codes include:
-  //       121C Indicates that the user is not authorized to perform the 
requested command.
-  //       1232 The command could not be completed because of a permanent 
error.
-  //         In most cases, the server will be in the process of an abend.
-  //       220A The target server has received an invalid data description.
-  //         If a user SQLDA is specified, ensure that the fields are
-  //         initialized correctly. Also, ensure that the length does not
-  //         exceed the maximum allowed length for the data type being used.
-  //
-  // The command or statement cannot be processed.  The current
-  // transaction is rolled back and the application is disconnected
-  //  from the remote database.
-  //
-  //
-  // Returned from Server:
-  //   SVRCOD - required  (0 - INFO, 4 - WARNING, 8 - ERROR, 16 - SEVERE,
-  //                       32 - ACCDMG, 64 - PRMDMG, 128 - SESDMG))
-  //   RDBNAM - optional (MINLVL 3)
-  //   RECCNT - optional (MINVAL 0, MINLVL 3) 
-  //
-  // Called by all the Reply classesCMDCHKRM
-  protected void parseCMDCHKRM () throws DisconnectException
-  {
-    boolean svrcodReceived = false;
-    int svrcod = CodePoint.SVRCOD_INFO;
-    boolean rdbnamReceived = false;
-    String rdbnam = null;
-    parseLengthAndMatchCodePoint (CodePoint.CMDCHKRM);
-    pushLengthOnCollectionStack();
-    int peekCP = peekCodePoint();
-
-    while (peekCP != Reply.END_OF_COLLECTION) {
-
-      boolean foundInPass = false;
-
-      if (peekCP == CodePoint.SVRCOD) {
-        foundInPass = true;
-        svrcodReceived = checkAndGetReceivedFlag (svrcodReceived);
-        svrcod = parseSVRCOD (CodePoint.SVRCOD_INFO, CodePoint.SVRCOD_SESDMG);
-        peekCP = peekCodePoint();
-      }
+    protected void readXaRecover(NetConnection conn) throws 
DisconnectException {
+    }
 
-      if (peekCP == CodePoint.RDBNAM) {
-        foundInPass = true;
-        rdbnamReceived = checkAndGetReceivedFlag (rdbnamReceived);
-        rdbnam = parseRDBNAM (true);
-        peekCP = peekCodePoint();
-      }
-      // skip over the RECCNT since it can't be found in the DDM book.
+    protected void readXaForget(NetConnection conn) throws DisconnectException 
{
+    }
 
-      if (peekCP == 0x115C) {
-        foundInPass = true;
-        parseLengthAndMatchCodePoint (0x115C);
-        skipBytes();
-        peekCP = peekCodePoint();
-      }
 
-      if (!foundInPass)
-        doPrmnsprmSemantics (peekCP);
+    //------------------parse reply for specific 
command--------------------------
+    // These methods are "private protected", which is not a recognized java 
privilege,
+    // but means that these methods are private to this class and to 
subclasses,
+    // and should not be used as package-wide friendly methods.
+
+    // Parse the reply for the RDB Commit Unit of Work Command.
+    // This method handles the parsing of all command replies and reply data
+    // for the rdbcmm command.
+    private void parseRDBCMMreply(ConnectionCallbackInterface connection) 
throws DisconnectException {
+        int peekCP = parseTypdefsOrMgrlvlovrs();
+
+        if (peekCP != CodePoint.ENDUOWRM && peekCP != CodePoint.SQLCARD) {
+            parseCommitError(connection);
+            return;
+        }
+
+        if (peekCP == CodePoint.ENDUOWRM) {
+            parseENDUOWRM(connection);
+            peekCP = parseTypdefsOrMgrlvlovrs();
+        }
 
+        NetSqlca netSqlca = parseSQLCARD(null);
+        connection.completeSqlca(netSqlca);
     }
-    popCollectionStack();
-    checkRequiredObjects (svrcodReceived);
 
-    netAgent_.setSvrcod (svrcod);
-    agent_.accumulateChainBreakingReadExceptionAndThrow (new 
DisconnectException (
-      agent_,
-      "Execution failed due to a distribution protocol error that caused " +
-      "deallocation of the conversation.  " +
-      "The requested command encountered an unarchitected and implementation " 
+
-      "specific condition for which there was no architected message.",
-      SqlState._58009));
-  }
-
-
-  // RDB Not Accessed Reply Message indicates that the access relational
-  // database command (ACCRDB) was not issued prior to a command
-  // requesting the RDB Services.
-  // PROTOCOL Architects an SQLSTATE of 58008 or 58009.
-  //
-  // Messages
-  // SQLSTATE : 58009
-  //     Execution failed due to a distribution protocol error that caused 
deallocation of the conversation.
-  //     SQLCODE : -30020
-  //     Execution failed because of a Distributed Protocol
-  //         Error that will affect the successful execution of subsequent
-  //         commands and SQL statements: Reason Code <reason-code>.
-  //      Some possible reason codes include:
-  //      121C Indicates that the user is not authorized to perform the 
requested command.
-  //      1232 The command could not be completed because of a permanent error.
-  //          In most cases, the server will be in the process of an abend.
-  //      220A The target server has received an invalid data description.
-  //          If a user SQLDA is specified, ensure that the fields are
-  //          initialized correctly. Also, ensure that the length does not
-  //          exceed the maximum allowed length for the data type being used.
-  //
-  //      The command or statement cannot be processed.  The current
-  //      transaction is rolled back and the application is disconnected
-  //      from the remote database.
-  //
-  //
-  // Returned from Server:
-  // SVRCOD - required  (8 - ERROR)
-  // RDBNAM - required
-  //
-  // Called by all the NET*Reply classes.
-  void parseRDBNACRM () throws DisconnectException
-  {
-    boolean svrcodReceived = false;
-    int svrcod = CodePoint.SVRCOD_INFO;
-    boolean rdbnamReceived = false;
-    String rdbnam = null;
-
-    parseLengthAndMatchCodePoint (CodePoint.RDBNACRM);
-    pushLengthOnCollectionStack();
-    int peekCP = peekCodePoint();
-
-    while (peekCP != Reply.END_OF_COLLECTION) {
-
-      boolean foundInPass = false;
-
-      if (peekCP == CodePoint.SVRCOD) {
-        foundInPass = true;
-        svrcodReceived = checkAndGetReceivedFlag (svrcodReceived);
-        svrcod = parseSVRCOD (CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR);
-        peekCP = peekCodePoint();
-      }
+    // Parse the reply for the RDB Rollback Unit of Work Command.
+    // This method handles the parsing of all command replies and reply data
+    // for the rdbrllbck command.
+    private void parseRDBRLLBCKreply(ConnectionCallbackInterface connection) 
throws DisconnectException {
+        int peekCP = parseTypdefsOrMgrlvlovrs();
+        if (peekCP != CodePoint.ENDUOWRM) {
+            parseRollbackError();
+            return;
+        }
 
-      if (peekCP == CodePoint.RDBNAM) {
-        foundInPass = true;
-        rdbnamReceived = checkAndGetReceivedFlag (rdbnamReceived);
-        rdbnam = parseRDBNAM (true);
-        peekCP = peekCodePoint();
-      }
+        parseENDUOWRM(connection);
+        peekCP = parseTypdefsOrMgrlvlovrs();
 
-      if (!foundInPass)
-        doPrmnsprmSemantics (peekCP);
+        NetSqlca netSqlca = parseSQLCARD(null);
+        connection.completeSqlca(netSqlca);
+    }
 
+    // Parse the reply for the Exchange Server Attributes Command.
+    // This method handles the parsing of all command replies and reply data
+    // for the excsat command.
+    private void parseEXCSATreply(NetConnection netConnection) throws 
DisconnectException {
+        if (peekCodePoint() != CodePoint.EXCSATRD) {
+            parseExchangeServerAttributesError();
+            return;
+        }
+        parseEXCSATRD(netConnection);
     }
-    popCollectionStack();
-    checkRequiredObjects (svrcodReceived, rdbnamReceived);
 
-    netAgent_.setSvrcod (svrcod);
-    agent_.accumulateChainBreakingReadExceptionAndThrow (new 
DisconnectException (
-      agent_,
-      "Execution failed due to a distribution protocol error that caused " +
-      "deallocation of the conversation.  " +
-      "The access relational database command was not issued prior to " +
-      "a command requesting RDB services.  ",
-      SqlState._58009));
-  }
-
-  // RDB Not Found Reply Message indicates that the target
-  // server cannot find the specified relational database.
-  // PROTOCOL architects an SQLSTATE of 08004.
-  //
-  // Messages
-  // SQLSTATE : 8004
-  //     The application server rejected establishment of the connection.
-  //     SQLCODE : -30061
-  //     The database alias or database name <name> was not found at the 
remote node.
-  //     The statement cannot be processed.
-  //
-  //
-  // Returned from Server:
-  // SVRCOD - required  (8 - ERROR)
-  // RDBNAM - required
-  //
-  private void parseRDBNFNRM (NetConnection netConnection) throws 
DisconnectException
-  {
-    boolean svrcodReceived = false;
-    int svrcod = CodePoint.SVRCOD_INFO;
-    boolean rdbnamReceived = false;
-    String rdbnam = null;
-
-    parseLengthAndMatchCodePoint (CodePoint.RDBNFNRM);
-    pushLengthOnCollectionStack();
-    int peekCP = peekCodePoint();
-
-    while (peekCP != Reply.END_OF_COLLECTION) {
-
-      boolean foundInPass = false;
-
-      if (peekCP == CodePoint.SVRCOD) {
-        foundInPass = true;
-        svrcodReceived = checkAndGetReceivedFlag (svrcodReceived);
-        svrcod = parseSVRCOD (CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR);
-        peekCP = peekCodePoint();
-      }
+    // Parse the reply for the Exchange Server Attributes Command (Dummy)
+    // This method handles the parsing of all command replies and reply data
+    // for the excsat command.
+    private void parseDummyEXCSATreply(NetConnection netConnection) throws 
DisconnectException {
+        if (peekCodePoint() != CodePoint.EXCSATRD) {
+            parseExchangeServerAttributesError();
+            return;
+        }
+        parseDummyEXCSATRD(netConnection);
+    }
+
+    // Parse the reply for the Access Security Command.
+    // This method handles the parsing of all command replies and reply data
+    // for the accsec command.
+    private void parseACCSECreply(NetConnection netConnection, int 
securityMechanism) throws DisconnectException {
+        int peekCP = peekCodePoint();
+        if (peekCP != CodePoint.ACCSECRD) {
+            parseAccessSecurityError(netConnection);
+            return;
+        }
+        parseACCSECRD(netConnection, securityMechanism);
 
-      if (peekCP == CodePoint.RDBNAM) {
-        foundInPass = true;
-        rdbnamReceived = checkAndGetReceivedFlag (rdbnamReceived);
-        rdbnam = parseRDBNAM (true);
         peekCP = peekCodePoint();
-      }
+        if (peekCP == Reply.END_OF_SAME_ID_CHAIN) {
+            return;
+        }
 
+    }
 
-      if (!foundInPass)
-        doPrmnsprmSemantics (peekCP);
+    // Parse the reply for the Security Check Command.
+    // This method handles the parsing of all command replies and reply data
+    // for the secchk command.
+    private void parseSECCHKreply(NetConnection netConnection) throws 
DisconnectException {
+        if (peekCodePoint() != CodePoint.SECCHKRM) {
+            parseSecurityCheckError(netConnection);
+            return;
+        }
 
+        parseSECCHKRM(netConnection);
+        if (peekCodePoint() == CodePoint.SECTKN) {
+            // rpydta used only if the security mechanism returns
+            // a security token that must be sent back to the source system.
+            // this is only used for DCSSEC.  In the case of DCESEC,
+            // the sectkn must be returned as reply data if DCE is using
+            // mutual authentication.
+            // Need to double check what to map this to.  This is probably
+            // incorrect but consider it a conversation protocol error
+            // 0x03 - OBJDSS sent when not allowed.
+            //parseSECTKN (true);
+            boolean done = false;
+            byte[] bytes = parseSECTKN(false);
+        }
     }
-    popCollectionStack();
-    checkRequiredObjects (svrcodReceived, rdbnamReceived);
-
-    netAgent_.setSvrcod (svrcod);
-    agent_.accumulateChainBreakingReadExceptionAndThrow (new 
DisconnectException (
-      agent_,
-      "The application server rejected establishment of the connection.  " +
-      "An attempt was made to access a database, " +
-      netConnection.databaseName_ + ", which was not found.",
-      SqlState._08004));
-  }
-
-
-  // Not Authorized to RDB Reply Message specifies that
-  // the requester is not authorized to access the specified
-  // relational database.
-  // PROTOCOL architects an SQLSTATE of 08004
-  //
-  // Messages
-  // SQLSTATE : 8004
-  //     Authorization ID <authorization-ID> attempted to perform the specified
-  //     <operation> without having been granted the proper authorization to 
do so.
-  //     SQLCODE : -30060
-  //      <authorization-ID> does not have the privilege to perform operation 
<operation>.
-  //
-  //
-  // Returned from Server:
-  // SVRCOD - required  (8 - ERROR)
-  // RDBNAM - required
-  //
-  private void parseRDBATHRM (NetConnection netConnection) throws 
DisconnectException
-  {
-    boolean svrcodReceived = false;
-    int svrcod = CodePoint.SVRCOD_INFO;
-    boolean rdbnamReceived = false;
-    String rdbnam = null;
-
-    parseLengthAndMatchCodePoint (CodePoint.RDBATHRM);
-    pushLengthOnCollectionStack();
-    int peekCP = peekCodePoint();
-
-    while (peekCP != Reply.END_OF_COLLECTION) {
-
-      boolean foundInPass = false;
-
-      if (peekCP == CodePoint.SVRCOD) {
-        foundInPass = true;
-        svrcodReceived = checkAndGetReceivedFlag (svrcodReceived);
-        svrcod = parseSVRCOD (CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR);
-        peekCP = peekCodePoint();
-      }
 
-      if (peekCP == CodePoint.RDBNAM) {
-        foundInPass = true;
-        rdbnamReceived = checkAndGetReceivedFlag (rdbnamReceived);
-        rdbnam = parseRDBNAM (true);
+    // Parse the reply for the Access RDB Command.
+    // This method handles the parsing of all command replies and reply data
+    // for the accrdb command.
+    private void parseACCRDBreply(NetConnection netConnection) throws 
DisconnectException {
+        int peekCP = peekCodePoint();
+        if (peekCP != CodePoint.ACCRDBRM) {
+            parseAccessRdbError(netConnection);
+            return;
+        }
+
+        parseACCRDBRM(netConnection);
         peekCP = peekCodePoint();
-      }
+        if (peekCP == Reply.END_OF_SAME_ID_CHAIN) {
+            return;
+        }
+
+        parseTypdefsOrMgrlvlovrs();
+        NetSqlca netSqlca = parseSQLCARD(null);
+        netConnection.completeSqlca(netSqlca);
+    }
 
-      if (!foundInPass)
-        doPrmnsprmSemantics (peekCP);
 
+    protected int parseTypdefsOrMgrlvlovrs() throws DisconnectException {
+        boolean targetTypedefCloned = false;
+        while (true) {
+            int peekCP = peekCodePoint();
+            if (peekCP == CodePoint.TYPDEFNAM) {
+                if (!targetTypedefCloned) {
+                    netAgent_.targetTypdef_ = (Typdef) 
netAgent_.targetTypdef_.clone();
+                    targetTypedefCloned = true;
+                }
+                parseTYPDEFNAM();
+            } else if (peekCP == CodePoint.TYPDEFOVR) {
+                if (!targetTypedefCloned) {
+                    netAgent_.targetTypdef_ = (Typdef) 
netAgent_.targetTypdef_.clone();
+                    targetTypedefCloned = true;
+                }
+                parseTYPDEFOVR();
+            } else {
+                return peekCP;
+            }
+        }
     }
-    popCollectionStack();
-    checkRequiredObjects (svrcodReceived, rdbnamReceived);
 
-    netAgent_.setSvrcod (svrcod);
-    netAgent_.accumulateReadException (new SqlException (agent_.logWriter_,
-      "The application server rejected establishment of the connection.  " +
-      "The user is not authorized to access the database.",
-      SqlState._08004));
-  }
-
-  // Data Stream Syntax Error Reply Message indicates that the data
-  // sent to the target agent does not structurally conform to the requirements
-  // of the DDM architecture.  The target agent terminated paring of the DSS
-  // when the condition SYNERRCD specified was detected.
-  // PROTOCOL architects an SQLSTATE of 58008 or 58009.
-  //
-  // Messages
-  // SQLSTATE : 58009
-  //     Execution failed due to a distribution protocol error that caused 
deallocation of the conversation.
-  //     SQLCODE : -30020
-  //     Execution failed because of a Distributed Protocol
-  //         Error that will affect the successful execution of subsequent
-  //         commands and SQL statements: Reason Code <reason-code>.
-  //      Some possible reason codes include:
-  //      121C Indicates that the user is not authorized to perform the 
requested command.
-  //      1232 The command could not be completed because of a permanent error.
-  //          In most cases, the server will be in the process of an abend.
-  //      220A The target server has received an invalid data description.
-  //          If a user SQLDA is specified, ensure that the fields are
-  //          initialized correctly. Also, ensure that the length does not
-  //          exceed the maximum allowed length for the data type being used.
-  //
-  //      The command or statement cannot be processed.  The current
-  //          transaction is rolled back and the application is disconnected
-  //          from the remote database.
-  //
-  //
-  // Returned from Server:
-  // SVRCOD - required  (8 - ERROR)
-  // SYNERRCD - required
-  // RECCNT - optional (MINVAL 0, MINLVL 3) (will not be returned - should be 
ignored)
-  // CODPNT - optional (MINLVL 3)
-  // RDBNAM - optional (MINLVL 3)
-  //
-  protected void parseSYNTAXRM () throws DisconnectException
-  {
-    boolean svrcodReceived = false;
-    int svrcod = CodePoint.SVRCOD_INFO;
-    boolean synerrcdReceived = false;
-    int synerrcd = 0;
-    boolean rdbnamReceived = false;
-    String rdbnam = null;
-    boolean codpntReceived = false;
-    int codpnt = 0;
-
-    parseLengthAndMatchCodePoint (CodePoint.SYNTAXRM);
-    pushLengthOnCollectionStack();
-    int peekCP = peekCodePoint();
-
-    while (peekCP != Reply.END_OF_COLLECTION) {
-
-      boolean foundInPass = false;
-
-      if (peekCP == CodePoint.SVRCOD) {
-        foundInPass = true;
-        svrcodReceived = checkAndGetReceivedFlag (svrcodReceived);
-        svrcod = parseSVRCOD (CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR);
-        peekCP = peekCodePoint();
-      }
 
-      if (peekCP == CodePoint.SYNERRCD) {
-        foundInPass = true;
-        synerrcdReceived = checkAndGetReceivedFlag (synerrcdReceived);
-        synerrcd = parseSYNERRCD();
-        peekCP = peekCodePoint();
-      }
+    //-----------------------------parse DDM Reply 
Messages-----------------------
 
-      if (peekCP == CodePoint.RDBNAM) {
-        foundInPass = true;
-        rdbnamReceived = checkAndGetReceivedFlag (rdbnamReceived);
-        rdbnam = parseRDBNAM (true);
-        peekCP = peekCodePoint();
-      }
+    protected void parseCommitError(ConnectionCallbackInterface connection) 
throws DisconnectException {
+        int peekCP = peekCodePoint();
+        switch (peekCP) {
+        case CodePoint.ABNUOWRM:
+            NetSqlca sqlca = parseAbnormalEndUow(connection);
+            connection.completeSqlca(sqlca);
+            break;
+        case CodePoint.CMDCHKRM:
+            parseCMDCHKRM();
+            break;
+        case CodePoint.RDBNACRM:
+            parseRDBNACRM();
+            break;
+        default:
+            parseCommonError(peekCP);
+            break;
+        }
+    }
 
-      if (peekCP == CodePoint.CODPNT) {
-        foundInPass = true;
-        codpntReceived = checkAndGetReceivedFlag (codpntReceived);
-        codpnt = parseCODPNT();
-        peekCP = peekCodePoint();
-      }
+    void parseRollbackError() throws DisconnectException {
+        int peekCP = peekCodePoint();
+        switch (peekCP) {
+        case CodePoint.CMDCHKRM:
+            parseCMDCHKRM();
+            break;
+        case CodePoint.RDBNACRM:
+            parseRDBNACRM();
+            break;
+        default:
+            parseCommonError(peekCP);
+            break;
+        }
+    }
 
-      // RECCNT will be skipped.
+    void parseExchangeServerAttributesError() throws DisconnectException {
+        int peekCP = peekCodePoint();
+        switch (peekCP) {
+        case CodePoint.CMDCHKRM:
+            parseCMDCHKRM();
+            break;
+        case CodePoint.MGRLVLRM:
+            parseMGRLVLRM();
+            break;
+        default:
+            parseCommonError(peekCP);
+        }
+    }
 
-      if (!foundInPass)
-        doPrmnsprmSemantics (peekCP);
+    void parseAccessSecurityError(NetConnection netConnection) throws 
DisconnectException {
+        int peekCP = peekCodePoint();
+        switch (peekCP) {
+        case CodePoint.CMDCHKRM:
+            parseCMDCHKRM();
+            break;
+        case CodePoint.RDBNFNRM:
+            parseRDBNFNRM(netConnection);
+            break;
+        case CodePoint.RDBAFLRM:
+            parseRdbAccessFailed(netConnection);
+            break;
+        default:
+            parseCommonError(peekCP);
+        }
     }
-    popCollectionStack();
-    checkRequiredObjects (svrcodReceived, synerrcdReceived);
-
-    netAgent_.setSvrcod (svrcod);
-    doSyntaxrmSemantics (codpnt);
-  }
-
-  // RDB Currently Accessed Reply Message inidcates that the
-  // ACCRDB command cannot be issued because the requester
-  // has access to a relational database.
-  // PROTOCOL architects an SQLSTATE of 58008 or 58009.
-  //
-  // Messages
-  // SQLSTATE : 58009
-  //     Execution failed due to a distribution protocol error that caused 
deallocation of the conversation.
-  //     SQLCODE : -30020
-  //     Execution failed because of a Distributed Protocol
-  //         Error that will affect the successful execution of subsequent
-  //         commands and SQL statements: Reason Code <reason-code>.
-  //      Some possible reason codes include:
-  //      121C Indicates that the user is not authorized to perform the 
requested command.
-  //      1232 The command could not be completed because of a permanent error.
-  //          In most cases, the server will be in the process of an abend.
-  //      220A The target server has received an invalid data description.
-  //          If a user SQLDA is specified, ensure that the fields are
-  //          initialized correctly. Also, ensure that the length does not
-  //          exceed the maximum allowed length for the data type being used.
-  //
-  //      The command or statement cannot be processed.  The current
-  //      transaction is rolled back and the application is disconnected
-  //      from the remote database.
-  //
-  //
-  // Returned from Server:
-  // SVRCOD - required  (8 - ERROR)
-  // RDBNAM - required
-  //
-  private void parseRDBACCRM () throws DisconnectException
-  {
-    boolean svrcodReceived = false;
-    int svrcod = CodePoint.SVRCOD_INFO;
-    boolean rdbnamReceived = false;
-    String rdbnam = null;
-
-    parseLengthAndMatchCodePoint (CodePoint.RDBACCRM);
-    pushLengthOnCollectionStack();
-    int peekCP = peekCodePoint();
-
-    while (peekCP != Reply.END_OF_COLLECTION) {
-
-      boolean foundInPass = false;
-
-      if (peekCP == CodePoint.SVRCOD) {
-        foundInPass = true;
-        svrcodReceived = checkAndGetReceivedFlag (svrcodReceived);
-        svrcod = parseSVRCOD (CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR);
-        peekCP = peekCodePoint();
-      }
 
-      if (peekCP == CodePoint.RDBNAM) {
-        foundInPass = true;
-        rdbnamReceived = checkAndGetReceivedFlag (rdbnamReceived);
-        rdbnam = parseRDBNAM (true);
-        peekCP = peekCodePoint();
-      }
+    void parseSecurityCheckError(NetConnection netConnection) throws 
DisconnectException {
+        int peekCP = peekCodePoint();
+        switch (peekCP) {
+        case CodePoint.CMDCHKRM:
+            parseCMDCHKRM();
+            break;
+        case CodePoint.OBJNSPRM:
+            parseOBJNSPRM();
+            break;
+        case CodePoint.RDBNFNRM:
+            parseRDBNFNRM(netConnection);
+            break;
+        case CodePoint.RDBAFLRM:
+            parseRdbAccessFailed(netConnection);
+            break;
+        default:
+            parseCommonError(peekCP);
+        }
+    }
 
-      if (!foundInPass)
-        doPrmnsprmSemantics (peekCP);
+    void parseAccessRdbError(NetConnection netConnection) throws 
DisconnectException {
+        int peekCP = peekCodePoint();
+        switch (peekCP) {
+        case CodePoint.CMDCHKRM:
+            parseCMDCHKRM();
+            break;
+        case CodePoint.RDBACCRM:
+            parseRDBACCRM();
+            break;
+        case CodePoint.RDBAFLRM:
+            parseRdbAccessFailed(netConnection);
+            break;
+        case CodePoint.RDBATHRM:
+            parseRDBATHRM(netConnection);
+            break;
+        case CodePoint.RDBNFNRM:
+            parseRDBNFNRM(netConnection);
+            break;
+        default:
+            parseCommonError(peekCP);
+        }
+    }
 
+
+    // Called by all the NET*Reply classes.
+    void parseCommonError(int peekCP) throws DisconnectException {
+        switch (peekCP) {
+        case CodePoint.CMDNSPRM:
+            parseCMDNSPRM();
+            break;
+        case CodePoint.PRCCNVRM:
+            parsePRCCNVRM();
+            break;
+        case CodePoint.SYNTAXRM:
+            parseSYNTAXRM();
+            break;
+        case CodePoint.VALNSPRM:
+            parseVALNSPRM();
+            break;
+        default:
+            doObjnsprmSemantics(peekCP);
+        }
     }
-    popCollectionStack();
-    checkRequiredObjects (svrcodReceived, rdbnamReceived);
 
-    netAgent_.setSvrcod (svrcod);
-    agent_.accumulateChainBreakingReadExceptionAndThrow (new 
DisconnectException (
-      agent_,
-      "Execution failed due to a distribution protocol error that caused " +
-      "deallocation of the conversation.  " +
-      "The access relational database command cannot be issued because an " +
-      "RDB is already currently accessed.",
-      SqlState._58009));
-  }
-
-  // RDB Access Failed Reply Message specifies that the relational
-  // database failed the attempted connection.
-  // An SQLCARD object must also be returned, following the
-  // RDBAFLRM, to explain why the RDB failed the connection.
-  // In addition, the target SQLAM instance is destroyed.
-  // The SQLSTATE is returned in the SQLCARD.
-  //
-  // Messages
-  // SQLSTATE : 58009
-  //     Execution failed due to a distribution protocol error that caused 
deallocation of the conversation.
-  //     SQLCODE : -30020
-  //     Execution failed because of a Distributed Protocol
-  //         Error that will affect the successful execution of subsequent
-  //         commands and SQL statements: Reason Code <reason-code>.
-  //      Some possible reason codes include:
-  //      121C Indicates that the user is not authorized to perform the 
requested command.
-  //      1232 The command could not be completed because of a permanent error.
-  //          In most cases, the server will be in the process of an abend.
-  //      220A The target server has received an invalid data description.
-  //          If a user SQLDA is specified, ensure that the fields are
-  //          initialized correctly. Also, ensure that the length does not
-  //          exceed the maximum allowed length for the data type being used.
-  //
-  //      The command or statement cannot be processed.  The current
-  //      transaction is rolled back and the application is disconnected
-  //      from the remote database.
-  //
-  //
-  // Returned from Server:
-  // SVRCOD - required  (8 - ERROR)
-  // RDBNAM - required
-  //
-  private void parseRDBAFLRM () throws DisconnectException
-  {
-    boolean svrcodReceived = false;
-    int svrcod = CodePoint.SVRCOD_INFO;
-    boolean rdbnamReceived = false;
-    String rdbnam = null;
-
-    parseLengthAndMatchCodePoint (CodePoint.RDBAFLRM);
-    pushLengthOnCollectionStack();
-    int peekCP = peekCodePoint();
-
-    while (peekCP != Reply.END_OF_COLLECTION) {
-
-      boolean foundInPass = false;
-
-      if (peekCP == CodePoint.SVRCOD) {
-        foundInPass = true;
-        svrcodReceived = checkAndGetReceivedFlag (svrcodReceived);
-        svrcod = parseSVRCOD (CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR);
-        peekCP = peekCodePoint();
-      }
+    NetSqlca parseAbnormalEndUow(ConnectionCallbackInterface connection) 
throws DisconnectException {
+        parseABNUOWRM(connection);
+        if (peekCodePoint() != CodePoint.SQLCARD) {
+            parseTypdefsOrMgrlvlovrs();
+        }
 
-      if (peekCP == CodePoint.RDBNAM) {
-        foundInPass = true;
-        rdbnamReceived = checkAndGetReceivedFlag (rdbnamReceived);
-        rdbnam = parseRDBNAM (true);
-        peekCP = peekCodePoint();
-      }
+        NetSqlca netSqlca = parseSQLCARD(null);
+        return netSqlca;
+    }
 
-      if (!foundInPass)
-        doPrmnsprmSemantics (peekCP);
+    void parseRdbAccessFailed(NetConnection netConnection) throws 
DisconnectException {
+        parseRDBAFLRM();
 
+        // an SQLCARD is returned if an RDBALFRM is returned.
+        // this SQLCARD always follows the RDBALFRM.
+        // TYPDEFNAM and TYPDEFOVR are MTLINC
+
+        if (peekCodePoint() == CodePoint.TYPDEFNAM) {
+            parseTYPDEFNAM();
+            parseTYPDEFOVR();
+        } else {
+            parseTYPDEFOVR();
+            parseTYPDEFNAM();
+        }
+
+        NetSqlca netSqlca = parseSQLCARD(null);
+        netConnection.completeSqlca(netSqlca);
     }
-    popCollectionStack();
-    checkRequiredObjects (svrcodReceived, rdbnamReceived);
 
-    netAgent_.setSvrcod (svrcod);
-  }
-
-
-  // Parameter Value Not Supported Reply Message indicates
-  // that the parameter value specified is either not recognized
-  // or not supported for the specified parameter.
-  // The VALNSPRM can only be specified in accordance with
-  // the rules specified for DDM subsetting.
-  // The code point of the command parameter in error is
-  // returned as a parameter in this message.
-  // PROTOCOL Architects an SQLSTATE of 58017.
-  //
-  // if codepoint is 0x119C,0x119D, or 0x119E then SQLSTATE 58017, SQLCODE -332
-  // else SQLSTATE 58017, SQLCODE -30073
-  //
-  // Messages
-  // SQLSTATE : 58017
-  //     The DDM parameter value is not supported.
-  //     SQLCODE : -332
-  //     There is no available conversion for the source code page
-  //         <code page> to the target code page <code page>.
-  //         Reason code <reason-code>.
-  //     The reason codes are as follows:
-  //     1 source and target code page combination is not supported
-  //         by the database manager.
-  //     2 source and target code page combination is either not
-  //         supported by the database manager or by the operating
-  //         system character conversion utility on the client node.
-  //     3 source and target code page combination is either not
-  //         supported by the database manager or by the operating
-  //         system character conversion utility on the server node.
-  //
-  // SQLSTATE : 58017
-  //     The DDM parameter value is not supported.
-  //     SQLCODE : -30073
-  //     <parameter-identifier> Parameter value <value> is not supported.
-  //     Some possible parameter identifiers include:
-  //     002F  The target server does not support the data type
-  //         requested by the application requester. 
-  //         The target server does not support the CCSID
-  //         requested by the application requester. Ensure the CCSID
-  //         used by the requester is supported by the server.
-  //         119C - Verify the single-byte CCSID.
-  //         119D - Verify the double-byte CCSID.
-  //         119E - Verify the mixed-byte CCSID.
-  //
-  //     The current environment command or SQL statement
-  //         cannot be processed successfully, nor can any subsequent
-  //         commands or SQL statements.  The current transaction is
-  //         rolled back and the application is disconnected
-  //         from the remote database. The command cannot be processed.
-  //
-  // Returned from Server:
-  // SVRCOD - required  (8 - ERROR)
-  // CODPNT - required
-  // RECCNT - optional (MINLVL 3, MINVAL 0) (will not be returned - should be 
ignored)
-  // RDBNAM - optional (MINLVL 3)
-  //
-  protected void parseVALNSPRM () throws DisconnectException
-  {
-    boolean svrcodReceived = false;
-    int svrcod = CodePoint.SVRCOD_INFO;
-    boolean rdbnamReceived = false;
-    String rdbnam = null;
-    boolean codpntReceived = false;
-    int codpnt = 0;
-
-    parseLengthAndMatchCodePoint (CodePoint.VALNSPRM);
-    pushLengthOnCollectionStack();
-    int peekCP = peekCodePoint();
-
-    while (peekCP != Reply.END_OF_COLLECTION) {
-
-      boolean foundInPass = false;
-
-      if (peekCP == CodePoint.SVRCOD) {
-        foundInPass = true;
-        svrcodReceived = checkAndGetReceivedFlag (svrcodReceived);
-        svrcod = parseSVRCOD (CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR);
-        peekCP = peekCodePoint();
-      }
 
-      if (peekCP == CodePoint.RDBNAM) {
-        foundInPass = true;
-        rdbnamReceived = checkAndGetReceivedFlag (rdbnamReceived);
-        rdbnam = parseRDBNAM (true);
-        peekCP = peekCodePoint();
-      }
+    // The Security Check (SECCHKRM) Reply Message indicates the acceptability
+    // of the security information.
+    // this method returns the security check code. it is up to the caller to 
check
+    // the value of this return code and take the appropriate action.
+    //
+    // Returned from Server:
+    // SVRCOD - required  (0 - INFO, 8 - ERROR, 16 -SEVERE)
+    // SECCHKCD - required
+    // SECTKN - optional, ignorable
+    // SVCERRNO - optional
+    private void parseSECCHKRM(NetConnection netConnection) throws 
DisconnectException {
+        boolean svrcodReceived = false;
+        int svrcod = CodePoint.SVRCOD_INFO;
+        boolean secchkcdReceived = false;
+        int secchkcd = CodePoint.SECCHKCD_00;
+        boolean sectknReceived = false;
+        byte[] sectkn = null;
+
+        parseLengthAndMatchCodePoint(CodePoint.SECCHKRM);
+        pushLengthOnCollectionStack();
+        int peekCP = peekCodePoint();
+
+        while (peekCP != Reply.END_OF_COLLECTION) {
+
+            boolean foundInPass = false;
+
+            if (peekCP == CodePoint.SVRCOD) {
+                // severity code.  it's value is dictated by the SECCHKCD.
+                // right now it will not be checked that it is the correct 
value
+                // for the SECCHKCD.  maybe this will be done in the future.
+                foundInPass = true;
+                svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
+                svrcod = parseSVRCOD(CodePoint.SVRCOD_INFO, 
CodePoint.SVRCOD_SEVERE);
+                peekCP = peekCodePoint();
+            }
+
+            if (peekCP == CodePoint.SECCHKCD) {
+                // security check code. this specifies the state of the 
security information.
+                // there is a relationship between this value and the SVRCOD 
value.
+                // right now this driver will not check these values against 
each other.
+                foundInPass = true;
+                secchkcdReceived = checkAndGetReceivedFlag(secchkcdReceived);
+                secchkcd = parseSECCHKCD();
+                peekCP = peekCodePoint();
+            }
+
+            if (peekCP == CodePoint.SECTKN) {
+                // security token.
+                // used when mutual authentication of the source and target 
servers
+                // is requested.  The architecture lists this as an instance 
variable
+                // and also says that the SECTKN flows as reply data to the 
secchk cmd and
+                // it must flow after the secchkrm message.  Right now this 
driver doesn't
+                // support ay mutual authentication so it will be ignored (it 
is listed
+                // as an ignorable instance variable in the ddm manual).
+                foundInPass = true;
+                sectknReceived = checkAndGetReceivedFlag(sectknReceived);
+                sectkn = parseSECTKN(true);
+                peekCP = peekCodePoint();
+            }
+
+            if (!foundInPass) {
+                doPrmnsprmSemantics(peekCP);
+            }
 
-      if (peekCP == CodePoint.CODPNT) {
-        foundInPass = true;
-        codpntReceived = checkAndGetReceivedFlag (codpntReceived);
-        codpnt = parseCODPNT();
-        peekCP = peekCodePoint();
-      }
+        }
+        popCollectionStack();
+        // check for the required instance variables.
+        checkRequiredObjects(svrcodReceived, secchkcdReceived);
+
+        netConnection.securityCheckComplete(svrcod, secchkcd);
+    }
+
+
+    // Access to RDB Completed (ACRDBRM) Reply Message specifies that an
+    // instance of the SQL application manager has been created and is bound
+    // to the specified relation database (RDB).
+    //
+    // Returned from Server:
+    // SVRCOD - required  (0 - INFO, 4 - WARNING)
+    // PRDID - required
+    // TYPDEFNAM - required (MINLVL 4) (QTDSQLJVM)
+    // TYPDEFOVR - required
+    // RDBINTTKN - optional
+    // CRRTKN - optional
+    // USRID - optional
+    // SRVLST - optional (MINLVL 5)
+    private void parseACCRDBRM(NetConnection netConnection) throws 
DisconnectException {
+        boolean svrcodReceived = false;
+        int svrcod = CodePoint.SVRCOD_INFO;
+        boolean prdidReceived = false;
+        String prdid = null;
+        boolean typdefnamReceived = false;
+        boolean typdefovrReceived = false;
+        boolean rdbinttknReceived = false;
+        boolean crrtknReceived = false;
+        byte[] crrtkn = null;
+        boolean usridReceived = false;
+        String usrid = null;
+
+        parseLengthAndMatchCodePoint(CodePoint.ACCRDBRM);
+        pushLengthOnCollectionStack();
+        int peekCP = peekCodePoint();
+
+        while (peekCP != Reply.END_OF_COLLECTION) {
+
+            boolean foundInPass = false;
+
+            if (peekCP == CodePoint.SVRCOD) {
+                // severity code.  If the target SQLAM cannot support the 
typdefovr
+                // parameter values specified for the double-byte and 
mixed-byte CCSIDs
+                // on the corresponding ACCRDB command, then the severity code 
WARNING
+                // is specified on the ACCRDBRM.
+                foundInPass = true;
+                svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
+                svrcod = parseSVRCOD(CodePoint.SVRCOD_INFO, 
CodePoint.SVRCOD_WARNING);
+                peekCP = peekCodePoint();
+            }
+
+            // this is the product release level of the target RDB server.
+            if (peekCP == CodePoint.PRDID) {
+                foundInPass = true;
+                prdidReceived = checkAndGetReceivedFlag(prdidReceived);
+                prdid = parsePRDID(false); // false means do not skip the bytes
+                peekCP = peekCodePoint();
+            }
+
+            if (peekCP == CodePoint.TYPDEFNAM) {
+                // this is the name of the data type to the data 
representation mapping
+                // definitions tha the target SQLAM uses when sending reply 
data objects.
+                foundInPass = true;
+                typdefnamReceived = checkAndGetReceivedFlag(typdefnamReceived);
+                parseTYPDEFNAM();
+                peekCP = peekCodePoint();
+            }
+
+            if (peekCP == CodePoint.TYPDEFOVR) {
+                // this is the single-byte, double-byte, and mixed-byte CCSIDs 
of the
+                // scalar data arrays (SDA) in the identified data type to 
data representation
+                // mapping definitions.
+                foundInPass = true;
+                typdefovrReceived = checkAndGetReceivedFlag(typdefovrReceived);
+                parseTYPDEFOVR();
+                peekCP = peekCodePoint();
+            }
+
+
+            if (peekCP == CodePoint.USRID) {
+                // specifies the target defined user ID.  It is returned if 
the value of
+                // TRGDFTRT is TRUE in ACCRDB.  Right now this driver always 
sets this
+                // value to false so this should never get returned here.
+                // if it is returned, it could be considered an error but for 
now
+                // this driver will just skip the bytes.
+                foundInPass = true;
+                usridReceived = checkAndGetReceivedFlag(usridReceived);
+                usrid = parseUSRID(true);
+                peekCP = peekCodePoint();
+            }
+
+            if (peekCP == CodePoint.CRRTKN) {
+                // carries information to correlate with the work being done 
on bahalf
+                // of an application at the source and at the target server.
+                // defualt value is ''.
+                // this parameter is only retunred if an only if the CRRTKN 
parameter
+                // is not received on ACCRDB.  We will rely on server to send 
us this
+                // in ACCRDBRM
+                foundInPass = true;
+                crrtknReceived = checkAndGetReceivedFlag(crrtknReceived);
+                crrtkn = parseCRRTKN(false);
+                peekCP = peekCodePoint();
+            }
+
+
+            if (!foundInPass) {
+                doPrmnsprmSemantics(peekCP);
+            }
+        }
+        popCollectionStack();
+        // check for the required instance variables.
+        checkRequiredObjects(svrcodReceived,
+                prdidReceived,
+                typdefnamReceived,
+                typdefovrReceived);
+
+        netConnection.rdbAccessed(svrcod,
+                prdid,
+                crrtknReceived,
+                crrtkn);
+    }
 
-      // RECCNT will be skipped
 
-      if (!foundInPass)
-        doPrmnsprmSemantics (peekCP);
+    // The End Unit of Work Condition (ENDUOWRM) Reply Mesage specifies
+    // that the unit of work has ended as a result of the last command.
+    //
+    // Returned from Server:
+    //   SVRCOD - required  (4 WARNING)
+    //   UOWDSP - required
+    //   RDBNAM - optional
+    void parseENDUOWRM(ConnectionCallbackInterface connection) throws 
DisconnectException {
+        boolean svrcodReceived = false;
+        int svrcod = CodePoint.SVRCOD_INFO;
+        boolean uowdspReceived = false;
+        int uowdsp = 0;
+        boolean rdbnamReceived = false;
+        String rdbnam = null;
+
+        parseLengthAndMatchCodePoint(CodePoint.ENDUOWRM);
+        pushLengthOnCollectionStack();
+        int peekCP = peekCodePoint();
+
+        while (peekCP != Reply.END_OF_COLLECTION) {
+
+            boolean foundInPass = false;
+
+            if (peekCP == CodePoint.SVRCOD) {
+                foundInPass = true;
+                svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
+                svrcod = parseSVRCOD(CodePoint.SVRCOD_WARNING, 
CodePoint.SVRCOD_WARNING);
+                peekCP = peekCodePoint();
+            }
+
+            if (peekCP == CodePoint.UOWDSP) {
+                foundInPass = true;
+                uowdspReceived = checkAndGetReceivedFlag(uowdspReceived);
+                uowdsp = parseUOWDSP();
+                peekCP = peekCodePoint();
+            }
+
+            if (peekCP == CodePoint.RDBNAM) {
+                foundInPass = true;
+                rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
+                rdbnam = parseRDBNAM(true);
+                peekCP = peekCodePoint();
+            }
+
+
+            if (!foundInPass) {
+                doPrmnsprmSemantics(peekCP);
+            }
+        }
+        popCollectionStack();
+        checkRequiredObjects(svrcodReceived, uowdspReceived);
 
+        netAgent_.setSvrcod(svrcod);
+        if (uowdsp == CodePoint.UOWDSP_COMMIT) {
+            connection.completeLocalCommit();
+        } else {
+            connection.completeLocalRollback();
+        }
     }
-    popCollectionStack();
-    checkRequiredObjects (svrcodReceived, codpntReceived);
-
-    netAgent_.setSvrcod (svrcod);
-    doValnsprmSemantics (codpnt, "\"\"");
-  }
-
-
-  // Conversational Protocol Error Reply Message
-  // indicates that a conversational protocol error occurred.
-  // PROTOCOL architects the SQLSTATE value depending on SVRCOD
-  // SVRCOD 8 -> SQLSTATE of 58008 or 58009
-  // SVRCOD 16,128 -> SQLSTATE of 58009
-  //
-  // Messages
-  // SQLSTATE : 58009
-  //     Execution failed due to a distribution protocol error that caused 
deallocation of the conversation.
-  //     SQLCODE : -30020
-  //     Execution failed because of a Distributed Protocol
-  //         Error that will affect the successful execution of subsequent
-  //         commands and SQL statements: Reason Code <reason-code>.
-  //      Some possible reason codes include:
-  //      121C Indicates that the user is not authorized to perform the 
requested command.
-  //      1232 The command could not be completed because of a permanent error.
-  //          In most cases, the server will be in the process of an abend.
-  //      220A The target server has received an invalid data description.
-  //          If a user SQLDA is specified, ensure that the fields are
-  //          initialized correctly. Also, ensure that the length does not
-  //          exceed the maximum allowed length for the data type being used.
-  //
-  //      The command or statement cannot be processed.  The current
-  //      transaction is rolled back and the application is disconnected
-  //      from the remote database.
-  //
-  //
-  // Returned from Server:
-  // SVRCOD - required  (8 - ERROR, 16 - SEVERE, 128 - SESDMG)
-  // PRCCNVCD - required
-  // RECCNT - optional (MINVAL 0, MINLVL 3)
-  // RDBNAM - optional (NINLVL 3)
-  //
-  protected void parsePRCCNVRM () throws DisconnectException
-  {
-    boolean svrcodReceived = false;
-    int svrcod = CodePoint.SVRCOD_INFO;
-    boolean rdbnamReceived = false;
-    String rdbnam = null;
-    boolean prccnvcdReceived = false;
-    int prccnvcd = 0;
-
-    parseLengthAndMatchCodePoint (CodePoint.PRCCNVRM);
-    pushLengthOnCollectionStack();
-    int peekCP = peekCodePoint();
-
-    while (peekCP != Reply.END_OF_COLLECTION) {
-
-      boolean foundInPass = false;
-
-      if (peekCP == CodePoint.SVRCOD) {
-        foundInPass = true;
-        svrcodReceived = checkAndGetReceivedFlag (svrcodReceived);
-        svrcod = parseSVRCOD (CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_SESDMG);
-        peekCP = peekCodePoint();
-      }
 
-      if (peekCP == CodePoint.RDBNAM) {
-        foundInPass = true;
-        rdbnamReceived = checkAndGetReceivedFlag (rdbnamReceived);
-        rdbnam = parseRDBNAM (true);
-        peekCP = peekCodePoint();
-      }
+    // Command Check Reply Message indicates that the requested
+    // command encountered an unarchitected and implementation-specific
+    // condition for which there is no architected message.  If the severity
+    // code value is ERROR or greater, the command has failed.  The
+    // message can be accompanied by other messages that help to identify
+    // the specific condition.
+    // The CMDCHKRM should not be used as a general catch-all in place of
+    // product-defined messages when using product extensions to DDM.
+    // PROTOCOL architects the SQLSTATE value depending on SVRCOD
+    // SVRCOD 0 -> SQLSTATE is not returned
+    // SVRCOD 8 -> SQLSTATE of 58008 or 58009
+    // SVRCOD 16,32,64,128 -> SQLSTATE of 58009
+    //
+    // Messages
+    //   SQLSTATE : 58009
+    //     Execution failed due to a distribution protocol error that caused 
deallocation of the conversation.
+    //     SQLCODE : -30020
+    //     Execution failed because of a Distributed Protocol
+    //       Error that will affect the successful execution of subsequent
+    //       commands and SQL statements: Reason Code <reason-code>.
+    //     Some possible reason codes include:
+    //       121C Indicates that the user is not authorized to perform the 
requested command.
+    //       1232 The command could not be completed because of a permanent 
error.
+    //         In most cases, the server will be in the process of an abend.
+    //       220A The target server has received an invalid data description.
+    //         If a user SQLDA is specified, ensure that the fields are
+    //         initialized correctly. Also, ensure that the length does not
+    //         exceed the maximum allowed length for the data type being used.
+    //
+    // The command or statement cannot be processed.  The current
+    // transaction is rolled back and the application is disconnected
+    //  from the remote database.
+    //
+    //
+    // Returned from Server:
+    //   SVRCOD - required  (0 - INFO, 4 - WARNING, 8 - ERROR, 16 - SEVERE,
+    //                       32 - ACCDMG, 64 - PRMDMG, 128 - SESDMG))
+    //   RDBNAM - optional (MINLVL 3)
+    //   RECCNT - optional (MINVAL 0, MINLVL 3)
+    //
+    // Called by all the Reply classesCMDCHKRM
+    protected void parseCMDCHKRM() throws DisconnectException {
+        boolean svrcodReceived = false;
+        int svrcod = CodePoint.SVRCOD_INFO;
+        boolean rdbnamReceived = false;
+        String rdbnam = null;
+        parseLengthAndMatchCodePoint(CodePoint.CMDCHKRM);
+        pushLengthOnCollectionStack();
+        int peekCP = peekCodePoint();
+
+        while (peekCP != Reply.END_OF_COLLECTION) {
+
+            boolean foundInPass = false;
+
+            if (peekCP == CodePoint.SVRCOD) {
+                foundInPass = true;
+                svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
+                svrcod = parseSVRCOD(CodePoint.SVRCOD_INFO, 
CodePoint.SVRCOD_SESDMG);
+                peekCP = peekCodePoint();
+            }
+
+            if (peekCP == CodePoint.RDBNAM) {
+                foundInPass = true;
+                rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
+                rdbnam = parseRDBNAM(true);
+                peekCP = peekCodePoint();
+            }
+            // skip over the RECCNT since it can't be found in the DDM book.
+
+            if (peekCP == 0x115C) {
+                foundInPass = true;
+                parseLengthAndMatchCodePoint(0x115C);
+                skipBytes();
+                peekCP = peekCodePoint();
+            }
+
+            if (!foundInPass) {
+                doPrmnsprmSemantics(peekCP);
+            }
 
-      if (peekCP == CodePoint.PRCCNVCD) {
-        foundInPass = true;
-        prccnvcdReceived = checkAndGetReceivedFlag (prccnvcdReceived);
-        prccnvcd = parsePRCCNVCD();
-        peekCP = peekCodePoint();
-      }
+        }
+        popCollectionStack();
+        checkRequiredObjects(svrcodReceived);
 
-      if (!foundInPass)
-        doPrmnsprmSemantics (peekCP);
+        netAgent_.setSvrcod(svrcod);
+        agent_.accumulateChainBreakingReadExceptionAndThrow(new 
DisconnectException(agent_,
+                "Execution failed due to a distribution protocol error that 
caused " +
+                "deallocation of the conversation.  " +
+                "The requested command encountered an unarchitected and 
implementation " +
+                "specific condition for which there was no architected 
message.",
+                SqlState._58009));
+    }
+
+
+    // RDB Not Accessed Reply Message indicates that the access relational
+    // database command (ACCRDB) was not issued prior to a command
+    // requesting the RDB Services.
+    // PROTOCOL Architects an SQLSTATE of 58008 or 58009.
+    //
+    // Messages
+    // SQLSTATE : 58009
+    //     Execution failed due to a distribution protocol error that caused 
deallocation of the conversation.
+    //     SQLCODE : -30020
+    //     Execution failed because of a Distributed Protocol
+    //         Error that will affect the successful execution of subsequent
+    //         commands and SQL statements: Reason Code <reason-code>.
+    //      Some possible reason codes include:
+    //      121C Indicates that the user is not authorized to perform the 
requested command.
+    //      1232 The command could not be completed because of a permanent 
error.
+    //          In most cases, the server will be in the process of an abend.
+    //      220A The target server has received an invalid data description.
+    //          If a user SQLDA is specified, ensure that the fields are
+    //          initialized correctly. Also, ensure that the length does not
+    //          exceed the maximum allowed length for the data type being used.
+    //
+    //      The command or statement cannot be processed.  The current
+    //      transaction is rolled back and the application is disconnected
+    //      from the remote database.
+    //
+    //
+    // Returned from Server:
+    // SVRCOD - required  (8 - ERROR)
+    // RDBNAM - required
+    //
+    // Called by all the NET*Reply classes.
+    void parseRDBNACRM() throws DisconnectException {
+        boolean svrcodReceived = false;
+        int svrcod = CodePoint.SVRCOD_INFO;
+        boolean rdbnamReceived = false;
+        String rdbnam = null;
+
+        parseLengthAndMatchCodePoint(CodePoint.RDBNACRM);
+        pushLengthOnCollectionStack();
+        int peekCP = peekCodePoint();
+
+        while (peekCP != Reply.END_OF_COLLECTION) {
+
+            boolean foundInPass = false;
+
+            if (peekCP == CodePoint.SVRCOD) {
+                foundInPass = true;
+                svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
+                svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, 
CodePoint.SVRCOD_ERROR);
+                peekCP = peekCodePoint();
+            }
+
+            if (peekCP == CodePoint.RDBNAM) {
+                foundInPass = true;
+                rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
+                rdbnam = parseRDBNAM(true);
+                peekCP = peekCodePoint();
+            }
+
+            if (!foundInPass) {
+                doPrmnsprmSemantics(peekCP);
+            }
+
+        }
+        popCollectionStack();
+        checkRequiredObjects(svrcodReceived, rdbnamReceived);
 
+        netAgent_.setSvrcod(svrcod);
+        agent_.accumulateChainBreakingReadExceptionAndThrow(new 
DisconnectException(agent_,
+                "Execution failed due to a distribution protocol error that 
caused " +
+                "deallocation of the conversation.  " +
+                "The access relational database command was not issued prior 
to " +
+                "a command requesting RDB services.  ",
+                SqlState._58009));
+    }
+
+    // RDB Not Found Reply Message indicates that the target
+    // server cannot find the specified relational database.
+    // PROTOCOL architects an SQLSTATE of 08004.
+    //
+    // Messages
+    // SQLSTATE : 8004
+    //     The application server rejected establishment of the connection.
+    //     SQLCODE : -30061
+    //     The database alias or database name <name> was not found at the 
remote node.
+    //     The statement cannot be processed.
+    //
+    //
+    // Returned from Server:
+    // SVRCOD - required  (8 - ERROR)
+    // RDBNAM - required
+    //
+    private void parseRDBNFNRM(NetConnection netConnection) throws 
DisconnectException {
+        boolean svrcodReceived = false;
+        int svrcod = CodePoint.SVRCOD_INFO;
+        boolean rdbnamReceived = false;
+        String rdbnam = null;
+
+        parseLengthAndMatchCodePoint(CodePoint.RDBNFNRM);
+        pushLengthOnCollectionStack();
+        int peekCP = peekCodePoint();
+
+        while (peekCP != Reply.END_OF_COLLECTION) {
+
+            boolean foundInPass = false;
+
+            if (peekCP == CodePoint.SVRCOD) {
+                foundInPass = true;
+                svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
+                svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, 
CodePoint.SVRCOD_ERROR);
+                peekCP = peekCodePoint();
+            }
+
+            if (peekCP == CodePoint.RDBNAM) {
+                foundInPass = true;
+                rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
+                rdbnam = parseRDBNAM(true);
+                peekCP = peekCodePoint();
+            }
+
+
+            if (!foundInPass) {
+                doPrmnsprmSemantics(peekCP);
+            }
+
+        }
+        popCollectionStack();
+        checkRequiredObjects(svrcodReceived, rdbnamReceived);
+
+        netAgent_.setSvrcod(svrcod);
+        agent_.accumulateChainBreakingReadExceptionAndThrow(new 
DisconnectException(agent_,
+                "The application server rejected establishment of the 
connection.  " +
+                "An attempt was made to access a database, " +
+                netConnection.databaseName_ + ", which was not found.",
+                SqlState._08004));
     }
-    popCollectionStack();
-    checkRequiredObjects (svrcodReceived, prccnvcdReceived);
 
-    netAgent_.setSvrcod (svrcod);
-    doPrccnvrmSemantics (CodePoint.PRCCNVRM);
-  }
-
-  // Object Not Supported Reply Message indicates that the target
-  // server does not recognize or support the object
-  // specified as data in an OBJDSS for the command associated
-  // with the object.
-  // The OBJNSPRM is also returned if an object is found in a
-  // valid collection in an OBJDSS (such as RECAL collection)
-  // that that is not valid for that collection.
-  // PROTOCOL Architects an SQLSTATE of 58015.
-  //
-  // Messages
-  // SQLSTATE : 58015
-  //     The DDM object is not supported.
-  //     SQLCODE : -30071
-  //      <object-identifier> Object is not supported.
-  //     The current transaction is rolled back and the application
-  //     is disconnected from the remote database. The command
-  //     cannot be processed.
-  //
-  //
-  // Returned from Server:
-  // SVRCOD - required  (8 - ERROR, 16 - SEVERE)
-  // CODPNT - required
-  // RECCNT - optional (MINVAL 0)  (will not be returned - should be ignored)
-  // RDBNAM - optional (MINLVL 3)
-  //
-  // Also called by NetPackageReply and NetStatementReply
-  void parseOBJNSPRM () throws DisconnectException
-  {
-    boolean svrcodReceived = false;
-    int svrcod = CodePoint.SVRCOD_INFO;
-    boolean rdbnamReceived = false;
-    String rdbnam = null;
-    boolean codpntReceived = false;
-    int codpnt = 0;
-
-    parseLengthAndMatchCodePoint (CodePoint.OBJNSPRM);
-    pushLengthOnCollectionStack();
-    int peekCP = peekCodePoint();
-
-    while (peekCP != Reply.END_OF_COLLECTION) {
-
-      boolean foundInPass = false;
-
-      if (peekCP == CodePoint.SVRCOD) {
-        foundInPass = true;
-        svrcodReceived = checkAndGetReceivedFlag (svrcodReceived);
-        svrcod = parseSVRCOD (CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_SEVERE);
-        peekCP = peekCodePoint();
-      }
 
-      if (peekCP == CodePoint.RDBNAM) {
-        foundInPass = true;
-        rdbnamReceived = checkAndGetReceivedFlag (rdbnamReceived);
-        rdbnam = parseRDBNAM (true);
-        peekCP = peekCodePoint();
-      }
+    // Not Authorized to RDB Reply Message specifies that
+    // the requester is not authorized to access the specified
+    // relational database.

[... 4061 lines stripped ...]

Reply via email to