0001: /*
0002:
0003: Derby - Class org.apache.derby.client.net.NetConnectionReply
0004:
0005: Licensed to the Apache Software Foundation (ASF) under one or more
0006: contributor license agreements. See the NOTICE file distributed with
0007: this work for additional information regarding copyright ownership.
0008: The ASF licenses this file to You under the Apache License, Version 2.0
0009: (the "License"); you may not use this file except in compliance with
0010: the License. You may obtain a copy of the License at
0011:
0012: http://www.apache.org/licenses/LICENSE-2.0
0013:
0014: Unless required by applicable law or agreed to in writing, software
0015: distributed under the License is distributed on an "AS IS" BASIS,
0016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0017: See the License for the specific language governing permissions and
0018: limitations under the License.
0019:
0020: */
0021:
0022: package org.apache.derby.client.net;
0023:
0024: import javax.transaction.xa.Xid;
0025:
0026: import org.apache.derby.client.am.Connection;
0027: import org.apache.derby.client.am.ConnectionCallbackInterface;
0028: import org.apache.derby.client.am.StatementCallbackInterface;
0029: import org.apache.derby.client.am.ResultSetCallbackInterface;
0030: import org.apache.derby.client.am.DisconnectException;
0031: import org.apache.derby.client.am.SqlException;
0032: import org.apache.derby.client.am.ClientMessageId;
0033: import org.apache.derby.client.am.Sqlca;
0034: import java.io.UnsupportedEncodingException;
0035: import org.apache.derby.client.am.UnitOfWorkListener;
0036:
0037: import org.apache.derby.shared.common.error.ExceptionSeverity;
0038: import org.apache.derby.shared.common.error.ExceptionUtil;
0039: import org.apache.derby.shared.common.reference.SQLState;
0040: import org.apache.derby.shared.common.reference.MessageId;
0041: import org.apache.derby.shared.common.i18n.MessageUtil;
0042:
0043: public class NetConnectionReply extends Reply implements
0044: ConnectionReplyInterface {
0045: private static MessageUtil msgutil_ = SqlException.getMessageUtil();
0046:
0047: NetConnectionReply(NetAgent netAgent, int bufferSize) {
0048: super (netAgent, bufferSize);
0049: }
0050:
0051: // NET only entry point
0052: void readExchangeServerAttributes(Connection connection)
0053: throws SqlException {
0054: startSameIdChainParse();
0055: parseEXCSATreply((NetConnection) connection);
0056: endOfSameIdChainData();
0057: agent_.checkForChainBreakingException_();
0058: }
0059:
0060: void verifyDeferredReset() throws SqlException {
0061: readDssHeader();
0062: verifyConnectReply(CodePoint.EXCSATRD);
0063: readDssHeader();
0064: verifyConnectReply(CodePoint.ACCSECRD);
0065: readDssHeader();
0066: verifyConnectReply(CodePoint.SECCHKRM);
0067: readDssHeader();
0068: verifyConnectReply(CodePoint.ACCRDBRM);
0069: agent_.checkForChainBreakingException_();
0070: }
0071:
0072: void verifyConnectReply(int codept) throws SqlException {
0073: if (peekCodePoint() != codept) {
0074: parseConnectError();
0075: return;
0076: }
0077: readLengthAndCodePoint();
0078: skipBytes();
0079:
0080: if (codept == CodePoint.ACCRDBRM) {
0081: int peekCP = peekCodePoint();
0082: if (peekCP == Reply.END_OF_SAME_ID_CHAIN) {
0083: return;
0084: }
0085:
0086: parseTypdefsOrMgrlvlovrs();
0087: NetSqlca netSqlca = parseSQLCARD(null);
0088: netAgent_.netConnection_.completeSqlca(netSqlca);
0089: }
0090: }
0091:
0092: void parseConnectError() throws DisconnectException {
0093: int peekCP = peekCodePoint();
0094: switch (peekCP) {
0095: case CodePoint.CMDCHKRM:
0096: parseCMDCHKRM();
0097: break;
0098: case CodePoint.MGRLVLRM:
0099: parseMGRLVLRM();
0100: break;
0101: default:
0102: parseCommonError(peekCP);
0103: }
0104: }
0105:
0106: void readDummyExchangeServerAttributes(Connection connection)
0107: throws SqlException {
0108: startSameIdChainParse();
0109: parseDummyEXCSATreply((NetConnection) connection);
0110: endOfSameIdChainData();
0111: agent_.checkForChainBreakingException_();
0112: }
0113:
0114: // NET only entry point
0115: void readAccessSecurity(Connection connection, int securityMechanism)
0116: throws SqlException {
0117: startSameIdChainParse();
0118: parseACCSECreply((NetConnection) connection, securityMechanism);
0119: endOfSameIdChainData();
0120: agent_.checkForChainBreakingException_();
0121: }
0122:
0123: // NET only entry point
0124: void readSecurityCheck(Connection connection) throws SqlException {
0125: startSameIdChainParse();
0126: parseSECCHKreply((NetConnection) connection);
0127: endOfSameIdChainData();
0128: agent_.checkForChainBreakingException_();
0129: }
0130:
0131: // NET only entry point
0132: void readAccessDatabase(Connection connection) throws SqlException {
0133: startSameIdChainParse();
0134: parseACCRDBreply((NetConnection) connection);
0135: endOfSameIdChainData();
0136: agent_.checkForChainBreakingException_();
0137: }
0138:
0139: public void readCommitSubstitute(
0140: ConnectionCallbackInterface connection)
0141: throws DisconnectException {
0142: startSameIdChainParse();
0143: parseDummyEXCSATreply((NetConnection) connection);
0144: endOfSameIdChainData();
0145: }
0146:
0147: public void readLocalCommit(ConnectionCallbackInterface connection)
0148: throws DisconnectException {
0149: startSameIdChainParse();
0150: parseRDBCMMreply(connection);
0151: endOfSameIdChainData();
0152: }
0153:
0154: public void readLocalRollback(ConnectionCallbackInterface connection)
0155: throws DisconnectException {
0156: startSameIdChainParse();
0157: parseRDBRLLBCKreply(connection);
0158: endOfSameIdChainData();
0159: }
0160:
0161: public void readLocalXAStart(ConnectionCallbackInterface connection)
0162: throws DisconnectException {
0163: }
0164:
0165: public void readLocalXACommit(ConnectionCallbackInterface connection)
0166: throws DisconnectException {
0167: }
0168:
0169: public void readLocalXARollback(
0170: ConnectionCallbackInterface connection)
0171: throws DisconnectException {
0172: }
0173:
0174: protected void readXaStartUnitOfWork(NetConnection conn)
0175: throws DisconnectException {
0176: }
0177:
0178: protected int readXaEndUnitOfWork(NetConnection conn)
0179: throws DisconnectException {
0180: return 0;
0181: }
0182:
0183: protected int readXaPrepare(NetConnection conn)
0184: throws DisconnectException {
0185: return 0;
0186: }
0187:
0188: protected void readXaCommit(NetConnection conn)
0189: throws DisconnectException {
0190: }
0191:
0192: protected int readXaRollback(NetConnection conn)
0193: throws DisconnectException {
0194: return 0;
0195: }
0196:
0197: protected void readXaRecover(NetConnection conn)
0198: throws DisconnectException {
0199: }
0200:
0201: protected void readXaForget(NetConnection conn)
0202: throws DisconnectException {
0203: }
0204:
0205: //------------------parse reply for specific command--------------------------
0206: // These methods are "private protected", which is not a recognized java privilege,
0207: // but means that these methods are private to this class and to subclasses,
0208: // and should not be used as package-wide friendly methods.
0209:
0210: // Parse the reply for the RDB Commit Unit of Work Command.
0211: // This method handles the parsing of all command replies and reply data
0212: // for the rdbcmm command.
0213: private void parseRDBCMMreply(ConnectionCallbackInterface connection)
0214: throws DisconnectException {
0215: int peekCP = parseTypdefsOrMgrlvlovrs();
0216:
0217: if (peekCP != CodePoint.ENDUOWRM && peekCP != CodePoint.SQLCARD) {
0218: parseCommitError(connection);
0219: return;
0220: }
0221:
0222: if (peekCP == CodePoint.ENDUOWRM) {
0223: parseENDUOWRM(connection);
0224: peekCP = parseTypdefsOrMgrlvlovrs();
0225: }
0226:
0227: NetSqlca netSqlca = parseSQLCARD(null);
0228: connection.completeSqlca(netSqlca);
0229: }
0230:
0231: // Parse the reply for the RDB Rollback Unit of Work Command.
0232: // This method handles the parsing of all command replies and reply data
0233: // for the rdbrllbck command.
0234: private void parseRDBRLLBCKreply(
0235: ConnectionCallbackInterface connection)
0236: throws DisconnectException {
0237: int peekCP = parseTypdefsOrMgrlvlovrs();
0238: if (peekCP != CodePoint.ENDUOWRM) {
0239: parseRollbackError();
0240: return;
0241: }
0242:
0243: parseENDUOWRM(connection);
0244: peekCP = parseTypdefsOrMgrlvlovrs();
0245:
0246: NetSqlca netSqlca = parseSQLCARD(null);
0247: connection.completeSqlca(netSqlca);
0248: }
0249:
0250: // Parse the reply for the Exchange Server Attributes Command.
0251: // This method handles the parsing of all command replies and reply data
0252: // for the excsat command.
0253: private void parseEXCSATreply(NetConnection netConnection)
0254: throws DisconnectException {
0255: if (peekCodePoint() != CodePoint.EXCSATRD) {
0256: parseExchangeServerAttributesError();
0257: return;
0258: }
0259: parseEXCSATRD(netConnection);
0260: }
0261:
0262: // Parse the reply for the Exchange Server Attributes Command (Dummy)
0263: // This method handles the parsing of all command replies and reply data
0264: // for the excsat command.
0265: private void parseDummyEXCSATreply(NetConnection netConnection)
0266: throws DisconnectException {
0267: if (peekCodePoint() != CodePoint.EXCSATRD) {
0268: parseExchangeServerAttributesError();
0269: return;
0270: }
0271: parseDummyEXCSATRD(netConnection);
0272: }
0273:
0274: // Parse the reply for the Access Security Command.
0275: // This method handles the parsing of all command replies and reply data
0276: // for the accsec command.
0277: private void parseACCSECreply(NetConnection netConnection,
0278: int securityMechanism) throws DisconnectException {
0279: int peekCP = peekCodePoint();
0280: if (peekCP != CodePoint.ACCSECRD) {
0281: parseAccessSecurityError(netConnection);
0282: return;
0283: }
0284: parseACCSECRD(netConnection, securityMechanism);
0285:
0286: peekCP = peekCodePoint();
0287: if (peekCP == Reply.END_OF_SAME_ID_CHAIN) {
0288: return;
0289: }
0290:
0291: }
0292:
0293: // Parse the reply for the Security Check Command.
0294: // This method handles the parsing of all command replies and reply data
0295: // for the secchk command.
0296: private void parseSECCHKreply(NetConnection netConnection)
0297: throws DisconnectException {
0298: if (peekCodePoint() != CodePoint.SECCHKRM) {
0299: parseSecurityCheckError(netConnection);
0300: return;
0301: }
0302:
0303: parseSECCHKRM(netConnection);
0304: if (peekCodePoint() == CodePoint.SECTKN) {
0305: // rpydta used only if the security mechanism returns
0306: // a security token that must be sent back to the source system.
0307: // this is only used for DCSSEC. In the case of DCESEC,
0308: // the sectkn must be returned as reply data if DCE is using
0309: // mutual authentication.
0310: // Need to double check what to map this to. This is probably
0311: // incorrect but consider it a conversation protocol error
0312: // 0x03 - OBJDSS sent when not allowed.
0313: //parseSECTKN (true);
0314: boolean done = false;
0315: byte[] bytes = parseSECTKN(false);
0316: }
0317: }
0318:
0319: // Parse the reply for the Access RDB Command.
0320: // This method handles the parsing of all command replies and reply data
0321: // for the accrdb command.
0322: private void parseACCRDBreply(NetConnection netConnection)
0323: throws DisconnectException {
0324: int peekCP = peekCodePoint();
0325: if (peekCP != CodePoint.ACCRDBRM) {
0326: parseAccessRdbError(netConnection);
0327: return;
0328: }
0329:
0330: parseACCRDBRM(netConnection);
0331: peekCP = peekCodePoint();
0332: if (peekCP == Reply.END_OF_SAME_ID_CHAIN) {
0333: return;
0334: }
0335:
0336: parseTypdefsOrMgrlvlovrs();
0337: NetSqlca netSqlca = parseSQLCARD(null);
0338: netConnection.completeSqlca(netSqlca);
0339: }
0340:
0341: protected int parseTypdefsOrMgrlvlovrs() throws DisconnectException {
0342: boolean targetTypedefCloned = false;
0343: while (true) {
0344: int peekCP = peekCodePoint();
0345: if (peekCP == CodePoint.TYPDEFNAM) {
0346: if (!targetTypedefCloned) {
0347: netAgent_.targetTypdef_ = (Typdef) netAgent_.targetTypdef_
0348: .clone();
0349: targetTypedefCloned = true;
0350: }
0351: parseTYPDEFNAM();
0352: } else if (peekCP == CodePoint.TYPDEFOVR) {
0353: if (!targetTypedefCloned) {
0354: netAgent_.targetTypdef_ = (Typdef) netAgent_.targetTypdef_
0355: .clone();
0356: targetTypedefCloned = true;
0357: }
0358: parseTYPDEFOVR();
0359: } else {
0360: return peekCP;
0361: }
0362: }
0363: }
0364:
0365: //-----------------------------parse DDM Reply Messages-----------------------
0366:
0367: protected void parseCommitError(
0368: ConnectionCallbackInterface connection)
0369: throws DisconnectException {
0370: int peekCP = peekCodePoint();
0371: switch (peekCP) {
0372: case CodePoint.ABNUOWRM:
0373: NetSqlca sqlca = parseAbnormalEndUow(connection, null);
0374: connection.completeSqlca(sqlca);
0375: break;
0376: case CodePoint.CMDCHKRM:
0377: parseCMDCHKRM();
0378: break;
0379: case CodePoint.RDBNACRM:
0380: parseRDBNACRM();
0381: break;
0382: default:
0383: parseCommonError(peekCP);
0384: break;
0385: }
0386: }
0387:
0388: void parseRollbackError() throws DisconnectException {
0389: int peekCP = peekCodePoint();
0390: switch (peekCP) {
0391: case CodePoint.CMDCHKRM:
0392: parseCMDCHKRM();
0393: break;
0394: case CodePoint.RDBNACRM:
0395: parseRDBNACRM();
0396: break;
0397: default:
0398: parseCommonError(peekCP);
0399: break;
0400: }
0401: }
0402:
0403: void parseExchangeServerAttributesError()
0404: throws DisconnectException {
0405: int peekCP = peekCodePoint();
0406: switch (peekCP) {
0407: case CodePoint.CMDCHKRM:
0408: parseCMDCHKRM();
0409: break;
0410: case CodePoint.MGRLVLRM:
0411: parseMGRLVLRM();
0412: break;
0413: default:
0414: parseCommonError(peekCP);
0415: }
0416: }
0417:
0418: void parseAccessSecurityError(NetConnection netConnection)
0419: throws DisconnectException {
0420: int peekCP = peekCodePoint();
0421: switch (peekCP) {
0422: case CodePoint.CMDCHKRM:
0423: parseCMDCHKRM();
0424: break;
0425: case CodePoint.RDBNFNRM:
0426: parseRDBNFNRM(netConnection);
0427: break;
0428: case CodePoint.RDBAFLRM:
0429: parseRdbAccessFailed(netConnection);
0430: break;
0431: default:
0432: parseCommonError(peekCP);
0433: }
0434: }
0435:
0436: void parseSecurityCheckError(NetConnection netConnection)
0437: throws DisconnectException {
0438: int peekCP = peekCodePoint();
0439: switch (peekCP) {
0440: case CodePoint.CMDCHKRM:
0441: parseCMDCHKRM();
0442: break;
0443: case CodePoint.OBJNSPRM:
0444: parseOBJNSPRM();
0445: break;
0446: case CodePoint.RDBNFNRM:
0447: parseRDBNFNRM(netConnection);
0448: break;
0449: case CodePoint.RDBAFLRM:
0450: parseRdbAccessFailed(netConnection);
0451: break;
0452: default:
0453: parseCommonError(peekCP);
0454: }
0455: }
0456:
0457: void parseAccessRdbError(NetConnection netConnection)
0458: throws DisconnectException {
0459: int peekCP = peekCodePoint();
0460: switch (peekCP) {
0461: case CodePoint.CMDCHKRM:
0462: parseCMDCHKRM();
0463: break;
0464: case CodePoint.RDBACCRM:
0465: parseRDBACCRM();
0466: break;
0467: case CodePoint.RDBAFLRM:
0468: parseRdbAccessFailed(netConnection);
0469: break;
0470: case CodePoint.RDBATHRM:
0471: parseRDBATHRM(netConnection);
0472: break;
0473: case CodePoint.RDBNFNRM:
0474: parseRDBNFNRM(netConnection);
0475: break;
0476: default:
0477: parseCommonError(peekCP);
0478: }
0479: }
0480:
0481: // Called by all the NET*Reply classes.
0482: void parseCommonError(int peekCP) throws DisconnectException {
0483: switch (peekCP) {
0484: case CodePoint.CMDNSPRM:
0485: parseCMDNSPRM();
0486: break;
0487: case CodePoint.PRCCNVRM:
0488: parsePRCCNVRM();
0489: break;
0490: case CodePoint.SYNTAXRM:
0491: parseSYNTAXRM();
0492: break;
0493: case CodePoint.VALNSPRM:
0494: parseVALNSPRM();
0495: break;
0496: default:
0497: doObjnsprmSemantics(peekCP);
0498: }
0499: }
0500:
0501: /**
0502: * Perform necessary actions for parsing of a ABNUOWRM message.
0503: *
0504: * @param connection an implementation of the ConnectionCallbackInterface
0505: *
0506: * @return an NetSqlca object obtained from parsing the ABNUOWRM
0507: * @throws DisconnectException
0508: *
0509: */
0510: NetSqlca parseAbnormalEndUow(
0511: ConnectionCallbackInterface connection,
0512: UnitOfWorkListener uwl) throws DisconnectException {
0513: parseABNUOWRM();
0514: if (peekCodePoint() != CodePoint.SQLCARD) {
0515: parseTypdefsOrMgrlvlovrs();
0516: }
0517:
0518: NetSqlca netSqlca = parseSQLCARD(null);
0519:
0520: if (ExceptionUtil.getSeverityFromIdentifier(netSqlca
0521: .getSqlState()) > ExceptionSeverity.STATEMENT_SEVERITY
0522: || uwl == null)
0523: connection.completeAbnormalUnitOfWork();
0524: else
0525: connection.completeAbnormalUnitOfWork(uwl);
0526:
0527: return netSqlca;
0528: }
0529:
0530: /**
0531: * Perform necessary actions for parsing of a ABNUOWRM message.
0532: *
0533: * @param s an implementation of the StatementCallbackInterface
0534: *
0535: * @return an NetSqlca object obtained from parsing the ABNUOWRM
0536: * @throws DisconnectException
0537: *
0538: */
0539: NetSqlca parseAbnormalEndUow(StatementCallbackInterface s)
0540: throws DisconnectException {
0541: return parseAbnormalEndUow(s.getConnectionCallbackInterface(),
0542: s);
0543: }
0544:
0545: /**
0546: * Perform necessary actions for parsing of a ABNUOWRM message.
0547: *
0548: * @param r an implementation of the ResultsetCallbackInterface
0549: *
0550: * @return an NetSqlca object obtained from parsing the ABNUOWRM
0551: * @throws DisconnectException
0552: *
0553: */
0554: NetSqlca parseAbnormalEndUow(ResultSetCallbackInterface r)
0555: throws DisconnectException {
0556: return parseAbnormalEndUow(r.getConnectionCallbackInterface(),
0557: r);
0558: }
0559:
0560: void parseRdbAccessFailed(NetConnection netConnection)
0561: throws DisconnectException {
0562: parseRDBAFLRM();
0563:
0564: // an SQLCARD is returned if an RDBALFRM is returned.
0565: // this SQLCARD always follows the RDBALFRM.
0566: // TYPDEFNAM and TYPDEFOVR are MTLINC
0567:
0568: if (peekCodePoint() == CodePoint.TYPDEFNAM) {
0569: parseTYPDEFNAM();
0570: parseTYPDEFOVR();
0571: } else {
0572: parseTYPDEFOVR();
0573: parseTYPDEFNAM();
0574: }
0575:
0576: NetSqlca netSqlca = parseSQLCARD(null);
0577:
0578: //Check if the SQLCARD has null SQLException
0579: if (netSqlca.getSqlErrmc() == null)
0580: netConnection.setConnectionNull(true);
0581: else
0582: netConnection.completeSqlca(netSqlca);
0583: }
0584:
0585: // The Security Check (SECCHKRM) Reply Message indicates the acceptability
0586: // of the security information.
0587: // this method returns the security check code. it is up to the caller to check
0588: // the value of this return code and take the appropriate action.
0589: //
0590: // Returned from Server:
0591: // SVRCOD - required (0 - INFO, 8 - ERROR, 16 -SEVERE)
0592: // SECCHKCD - required
0593: // SECTKN - optional, ignorable
0594: // SVCERRNO - optional
0595: private void parseSECCHKRM(NetConnection netConnection)
0596: throws DisconnectException {
0597: boolean svrcodReceived = false;
0598: int svrcod = CodePoint.SVRCOD_INFO;
0599: boolean secchkcdReceived = false;
0600: int secchkcd = CodePoint.SECCHKCD_00;
0601: boolean sectknReceived = false;
0602: byte[] sectkn = null;
0603:
0604: parseLengthAndMatchCodePoint(CodePoint.SECCHKRM);
0605: pushLengthOnCollectionStack();
0606: int peekCP = peekCodePoint();
0607:
0608: while (peekCP != Reply.END_OF_COLLECTION) {
0609:
0610: boolean foundInPass = false;
0611:
0612: if (peekCP == CodePoint.SVRCOD) {
0613: // severity code. it's value is dictated by the SECCHKCD.
0614: // right now it will not be checked that it is the correct value
0615: // for the SECCHKCD. maybe this will be done in the future.
0616: foundInPass = true;
0617: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
0618: svrcod = parseSVRCOD(CodePoint.SVRCOD_INFO,
0619: CodePoint.SVRCOD_SEVERE);
0620: peekCP = peekCodePoint();
0621: }
0622:
0623: if (peekCP == CodePoint.SECCHKCD) {
0624: // security check code. this specifies the state of the security information.
0625: // there is a relationship between this value and the SVRCOD value.
0626: // right now this driver will not check these values against each other.
0627: foundInPass = true;
0628: secchkcdReceived = checkAndGetReceivedFlag(secchkcdReceived);
0629: secchkcd = parseSECCHKCD();
0630: peekCP = peekCodePoint();
0631: }
0632:
0633: if (peekCP == CodePoint.SECTKN) {
0634: // security token.
0635: // used when mutual authentication of the source and target servers
0636: // is requested. The architecture lists this as an instance variable
0637: // and also says that the SECTKN flows as reply data to the secchk cmd and
0638: // it must flow after the secchkrm message. Right now this driver doesn't
0639: // support ay mutual authentication so it will be ignored (it is listed
0640: // as an ignorable instance variable in the ddm manual).
0641: foundInPass = true;
0642: sectknReceived = checkAndGetReceivedFlag(sectknReceived);
0643: sectkn = parseSECTKN(true);
0644: peekCP = peekCodePoint();
0645: }
0646:
0647: if (!foundInPass) {
0648: doPrmnsprmSemantics(peekCP);
0649: }
0650:
0651: }
0652: popCollectionStack();
0653: // check for the required instance variables.
0654: checkRequiredObjects(svrcodReceived, secchkcdReceived);
0655:
0656: netConnection.securityCheckComplete(svrcod, secchkcd);
0657: }
0658:
0659: // Access to RDB Completed (ACRDBRM) Reply Message specifies that an
0660: // instance of the SQL application manager has been created and is bound
0661: // to the specified relation database (RDB).
0662: //
0663: // Returned from Server:
0664: // SVRCOD - required (0 - INFO, 4 - WARNING)
0665: // PRDID - required
0666: // TYPDEFNAM - required (MINLVL 4) (QTDSQLJVM)
0667: // TYPDEFOVR - required
0668: // RDBINTTKN - optional
0669: // CRRTKN - optional
0670: // USRID - optional
0671: // SRVLST - optional (MINLVL 5)
0672: private void parseACCRDBRM(NetConnection netConnection)
0673: throws DisconnectException {
0674: boolean svrcodReceived = false;
0675: int svrcod = CodePoint.SVRCOD_INFO;
0676: boolean prdidReceived = false;
0677: String prdid = null;
0678: boolean typdefnamReceived = false;
0679: boolean typdefovrReceived = false;
0680: boolean rdbinttknReceived = false;
0681: boolean crrtknReceived = false;
0682: byte[] crrtkn = null;
0683: boolean usridReceived = false;
0684: String usrid = null;
0685:
0686: parseLengthAndMatchCodePoint(CodePoint.ACCRDBRM);
0687: pushLengthOnCollectionStack();
0688: int peekCP = peekCodePoint();
0689:
0690: while (peekCP != Reply.END_OF_COLLECTION) {
0691:
0692: boolean foundInPass = false;
0693:
0694: if (peekCP == CodePoint.SVRCOD) {
0695: // severity code. If the target SQLAM cannot support the typdefovr
0696: // parameter values specified for the double-byte and mixed-byte CCSIDs
0697: // on the corresponding ACCRDB command, then the severity code WARNING
0698: // is specified on the ACCRDBRM.
0699: foundInPass = true;
0700: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
0701: svrcod = parseSVRCOD(CodePoint.SVRCOD_INFO,
0702: CodePoint.SVRCOD_WARNING);
0703: peekCP = peekCodePoint();
0704: }
0705:
0706: // this is the product release level of the target RDB server.
0707: if (peekCP == CodePoint.PRDID) {
0708: foundInPass = true;
0709: prdidReceived = checkAndGetReceivedFlag(prdidReceived);
0710: prdid = parsePRDID(false); // false means do not skip the bytes
0711: peekCP = peekCodePoint();
0712: }
0713:
0714: if (peekCP == CodePoint.TYPDEFNAM) {
0715: // this is the name of the data type to the data representation mapping
0716: // definitions tha the target SQLAM uses when sending reply data objects.
0717: foundInPass = true;
0718: typdefnamReceived = checkAndGetReceivedFlag(typdefnamReceived);
0719: parseTYPDEFNAM();
0720: peekCP = peekCodePoint();
0721: }
0722:
0723: if (peekCP == CodePoint.TYPDEFOVR) {
0724: // this is the single-byte, double-byte, and mixed-byte CCSIDs of the
0725: // scalar data arrays (SDA) in the identified data type to data representation
0726: // mapping definitions.
0727: foundInPass = true;
0728: typdefovrReceived = checkAndGetReceivedFlag(typdefovrReceived);
0729: parseTYPDEFOVR();
0730: peekCP = peekCodePoint();
0731: }
0732:
0733: if (peekCP == CodePoint.USRID) {
0734: // specifies the target defined user ID. It is returned if the value of
0735: // TRGDFTRT is TRUE in ACCRDB. Right now this driver always sets this
0736: // value to false so this should never get returned here.
0737: // if it is returned, it could be considered an error but for now
0738: // this driver will just skip the bytes.
0739: foundInPass = true;
0740: usridReceived = checkAndGetReceivedFlag(usridReceived);
0741: usrid = parseUSRID(true);
0742: peekCP = peekCodePoint();
0743: }
0744:
0745: if (peekCP == CodePoint.CRRTKN) {
0746: // carries information to correlate with the work being done on bahalf
0747: // of an application at the source and at the target server.
0748: // defualt value is ''.
0749: // this parameter is only retunred if an only if the CRRTKN parameter
0750: // is not received on ACCRDB. We will rely on server to send us this
0751: // in ACCRDBRM
0752: foundInPass = true;
0753: crrtknReceived = checkAndGetReceivedFlag(crrtknReceived);
0754: crrtkn = parseCRRTKN(false);
0755: peekCP = peekCodePoint();
0756: }
0757:
0758: if (!foundInPass) {
0759: doPrmnsprmSemantics(peekCP);
0760: }
0761: }
0762: popCollectionStack();
0763: // check for the required instance variables.
0764: checkRequiredObjects(svrcodReceived, prdidReceived,
0765: typdefnamReceived, typdefovrReceived);
0766:
0767: netConnection
0768: .rdbAccessed(svrcod, prdid, crrtknReceived, crrtkn);
0769: }
0770:
0771: // The End Unit of Work Condition (ENDUOWRM) Reply Mesage specifies
0772: // that the unit of work has ended as a result of the last command.
0773: //
0774: // Returned from Server:
0775: // SVRCOD - required (4 WARNING)
0776: // UOWDSP - required
0777: // RDBNAM - optional
0778: void parseENDUOWRM(ConnectionCallbackInterface connection)
0779: throws DisconnectException {
0780: boolean svrcodReceived = false;
0781: int svrcod = CodePoint.SVRCOD_INFO;
0782: boolean uowdspReceived = false;
0783: int uowdsp = 0;
0784: boolean rdbnamReceived = false;
0785: String rdbnam = null;
0786:
0787: parseLengthAndMatchCodePoint(CodePoint.ENDUOWRM);
0788: pushLengthOnCollectionStack();
0789: int peekCP = peekCodePoint();
0790:
0791: while (peekCP != Reply.END_OF_COLLECTION) {
0792:
0793: boolean foundInPass = false;
0794:
0795: if (peekCP == CodePoint.SVRCOD) {
0796: foundInPass = true;
0797: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
0798: svrcod = parseSVRCOD(CodePoint.SVRCOD_WARNING,
0799: CodePoint.SVRCOD_WARNING);
0800: peekCP = peekCodePoint();
0801: }
0802:
0803: if (peekCP == CodePoint.UOWDSP) {
0804: foundInPass = true;
0805: uowdspReceived = checkAndGetReceivedFlag(uowdspReceived);
0806: uowdsp = parseUOWDSP();
0807: peekCP = peekCodePoint();
0808: }
0809:
0810: if (peekCP == CodePoint.RDBNAM) {
0811: foundInPass = true;
0812: rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
0813: rdbnam = parseRDBNAM(true);
0814: peekCP = peekCodePoint();
0815: }
0816:
0817: if (!foundInPass) {
0818: doPrmnsprmSemantics(peekCP);
0819: }
0820: }
0821: popCollectionStack();
0822: checkRequiredObjects(svrcodReceived, uowdspReceived);
0823:
0824: netAgent_.setSvrcod(svrcod);
0825: if (uowdsp == CodePoint.UOWDSP_COMMIT) {
0826: connection.completeLocalCommit();
0827: } else {
0828: connection.completeLocalRollback();
0829: }
0830: }
0831:
0832: // Command Check Reply Message indicates that the requested
0833: // command encountered an unarchitected and implementation-specific
0834: // condition for which there is no architected message. If the severity
0835: // code value is ERROR or greater, the command has failed. The
0836: // message can be accompanied by other messages that help to identify
0837: // the specific condition.
0838: // The CMDCHKRM should not be used as a general catch-all in place of
0839: // product-defined messages when using product extensions to DDM.
0840: // PROTOCOL architects the SQLSTATE value depending on SVRCOD
0841: // SVRCOD 0 -> SQLSTATE is not returned
0842: // SVRCOD 8 -> SQLSTATE of 58008 or 58009
0843: // SVRCOD 16,32,64,128 -> SQLSTATE of 58009
0844: //
0845: // Messages
0846: // SQLSTATE : 58009
0847: // Execution failed due to a distribution protocol error that caused deallocation of the conversation.
0848: // SQLCODE : -30020
0849: // Execution failed because of a Distributed Protocol
0850: // Error that will affect the successful execution of subsequent
0851: // commands and SQL statements: Reason Code <reason-code>.
0852: // Some possible reason codes include:
0853: // 121C Indicates that the user is not authorized to perform the requested command.
0854: // 1232 The command could not be completed because of a permanent error.
0855: // In most cases, the server will be in the process of an abend.
0856: // 220A The target server has received an invalid data description.
0857: // If a user SQLDA is specified, ensure that the fields are
0858: // initialized correctly. Also, ensure that the length does not
0859: // exceed the maximum allowed length for the data type being used.
0860: //
0861: // The command or statement cannot be processed. The current
0862: // transaction is rolled back and the application is disconnected
0863: // from the remote database.
0864: //
0865: //
0866: // Returned from Server:
0867: // SVRCOD - required (0 - INFO, 4 - WARNING, 8 - ERROR, 16 - SEVERE,
0868: // 32 - ACCDMG, 64 - PRMDMG, 128 - SESDMG))
0869: // RDBNAM - optional (MINLVL 3)
0870: // RECCNT - optional (MINVAL 0, MINLVL 3)
0871: //
0872: // Called by all the Reply classesCMDCHKRM
0873: protected void parseCMDCHKRM() throws DisconnectException {
0874: boolean svrcodReceived = false;
0875: int svrcod = CodePoint.SVRCOD_INFO;
0876: boolean rdbnamReceived = false;
0877: String rdbnam = null;
0878: parseLengthAndMatchCodePoint(CodePoint.CMDCHKRM);
0879: pushLengthOnCollectionStack();
0880: int peekCP = peekCodePoint();
0881:
0882: while (peekCP != Reply.END_OF_COLLECTION) {
0883:
0884: boolean foundInPass = false;
0885:
0886: if (peekCP == CodePoint.SVRCOD) {
0887: foundInPass = true;
0888: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
0889: svrcod = parseSVRCOD(CodePoint.SVRCOD_INFO,
0890: CodePoint.SVRCOD_SESDMG);
0891: peekCP = peekCodePoint();
0892: }
0893:
0894: if (peekCP == CodePoint.RDBNAM) {
0895: foundInPass = true;
0896: rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
0897: rdbnam = parseRDBNAM(true);
0898: peekCP = peekCodePoint();
0899: }
0900: // skip over the RECCNT since it can't be found in the DDM book.
0901:
0902: if (peekCP == 0x115C) {
0903: foundInPass = true;
0904: parseLengthAndMatchCodePoint(0x115C);
0905: skipBytes();
0906: peekCP = peekCodePoint();
0907: }
0908:
0909: if (!foundInPass) {
0910: doPrmnsprmSemantics(peekCP);
0911: }
0912:
0913: }
0914: popCollectionStack();
0915: checkRequiredObjects(svrcodReceived);
0916:
0917: netAgent_.setSvrcod(svrcod);
0918: agent_
0919: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
0920: agent_,
0921: new ClientMessageId(
0922: SQLState.DRDA_CONNECTION_TERMINATED),
0923: msgutil_
0924: .getTextMessage(MessageId.CONN_DRDA_CMDCHKRM)));
0925: }
0926:
0927: // RDB Not Accessed Reply Message indicates that the access relational
0928: // database command (ACCRDB) was not issued prior to a command
0929: // requesting the RDB Services.
0930: // PROTOCOL Architects an SQLSTATE of 58008 or 58009.
0931: //
0932: // Messages
0933: // SQLSTATE : 58009
0934: // Execution failed due to a distribution protocol error that caused deallocation of the conversation.
0935: // SQLCODE : -30020
0936: // Execution failed because of a Distributed Protocol
0937: // Error that will affect the successful execution of subsequent
0938: // commands and SQL statements: Reason Code <reason-code>.
0939: // Some possible reason codes include:
0940: // 121C Indicates that the user is not authorized to perform the requested command.
0941: // 1232 The command could not be completed because of a permanent error.
0942: // In most cases, the server will be in the process of an abend.
0943: // 220A The target server has received an invalid data description.
0944: // If a user SQLDA is specified, ensure that the fields are
0945: // initialized correctly. Also, ensure that the length does not
0946: // exceed the maximum allowed length for the data type being used.
0947: //
0948: // The command or statement cannot be processed. The current
0949: // transaction is rolled back and the application is disconnected
0950: // from the remote database.
0951: //
0952: //
0953: // Returned from Server:
0954: // SVRCOD - required (8 - ERROR)
0955: // RDBNAM - required
0956: //
0957: // Called by all the NET*Reply classes.
0958: void parseRDBNACRM() throws DisconnectException {
0959: boolean svrcodReceived = false;
0960: int svrcod = CodePoint.SVRCOD_INFO;
0961: boolean rdbnamReceived = false;
0962: String rdbnam = null;
0963:
0964: parseLengthAndMatchCodePoint(CodePoint.RDBNACRM);
0965: pushLengthOnCollectionStack();
0966: int peekCP = peekCodePoint();
0967:
0968: while (peekCP != Reply.END_OF_COLLECTION) {
0969:
0970: boolean foundInPass = false;
0971:
0972: if (peekCP == CodePoint.SVRCOD) {
0973: foundInPass = true;
0974: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
0975: svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR,
0976: CodePoint.SVRCOD_ERROR);
0977: peekCP = peekCodePoint();
0978: }
0979:
0980: if (peekCP == CodePoint.RDBNAM) {
0981: foundInPass = true;
0982: rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
0983: rdbnam = parseRDBNAM(true);
0984: peekCP = peekCodePoint();
0985: }
0986:
0987: if (!foundInPass) {
0988: doPrmnsprmSemantics(peekCP);
0989: }
0990:
0991: }
0992: popCollectionStack();
0993: checkRequiredObjects(svrcodReceived, rdbnamReceived);
0994:
0995: netAgent_.setSvrcod(svrcod);
0996: agent_
0997: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
0998: agent_,
0999: new ClientMessageId(
1000: SQLState.DRDA_CONNECTION_TERMINATED),
1001: msgutil_
1002: .getTextMessage(MessageId.CONN_DRDA_RDBNACRM)));
1003: }
1004:
1005: // RDB Not Found Reply Message indicates that the target
1006: // server cannot find the specified relational database.
1007: // PROTOCOL architects an SQLSTATE of 08004.
1008: //
1009: // Messages
1010: // SQLSTATE : 8004
1011: // The application server rejected establishment of the connection.
1012: // SQLCODE : -30061
1013: // The database alias or database name <name> was not found at the remote node.
1014: // The statement cannot be processed.
1015: //
1016: //
1017: // Returned from Server:
1018: // SVRCOD - required (8 - ERROR)
1019: // RDBNAM - required
1020: //
1021: private void parseRDBNFNRM(NetConnection netConnection)
1022: throws DisconnectException {
1023: boolean svrcodReceived = false;
1024: int svrcod = CodePoint.SVRCOD_INFO;
1025: boolean rdbnamReceived = false;
1026: String rdbnam = null;
1027:
1028: parseLengthAndMatchCodePoint(CodePoint.RDBNFNRM);
1029: pushLengthOnCollectionStack();
1030: int peekCP = peekCodePoint();
1031:
1032: while (peekCP != Reply.END_OF_COLLECTION) {
1033:
1034: boolean foundInPass = false;
1035:
1036: if (peekCP == CodePoint.SVRCOD) {
1037: foundInPass = true;
1038: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
1039: svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR,
1040: CodePoint.SVRCOD_ERROR);
1041: peekCP = peekCodePoint();
1042: }
1043:
1044: if (peekCP == CodePoint.RDBNAM) {
1045: foundInPass = true;
1046: rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
1047: rdbnam = parseRDBNAM(true);
1048: peekCP = peekCodePoint();
1049: }
1050:
1051: if (!foundInPass) {
1052: doPrmnsprmSemantics(peekCP);
1053: }
1054:
1055: }
1056: popCollectionStack();
1057: checkRequiredObjects(svrcodReceived, rdbnamReceived);
1058:
1059: netAgent_.setSvrcod(svrcod);
1060: agent_
1061: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
1062: agent_, new ClientMessageId(
1063: SQLState.NET_DATABASE_NOT_FOUND),
1064: netConnection.databaseName_));
1065: }
1066:
1067: // Not Authorized to RDB Reply Message specifies that
1068: // the requester is not authorized to access the specified
1069: // relational database.
1070: // PROTOCOL architects an SQLSTATE of 08004
1071: //
1072: // Messages
1073: // SQLSTATE : 8004
1074: // Authorization ID <authorization-ID> attempted to perform the specified
1075: // <operation> without having been granted the proper authorization to do so.
1076: // SQLCODE : -30060
1077: // <authorization-ID> does not have the privilege to perform operation <operation>.
1078: //
1079: //
1080: // Returned from Server:
1081: // SVRCOD - required (8 - ERROR)
1082: // RDBNAM - required
1083: //
1084: private void parseRDBATHRM(NetConnection netConnection)
1085: throws DisconnectException {
1086: boolean svrcodReceived = false;
1087: int svrcod = CodePoint.SVRCOD_INFO;
1088: boolean rdbnamReceived = false;
1089: String rdbnam = null;
1090:
1091: parseLengthAndMatchCodePoint(CodePoint.RDBATHRM);
1092: pushLengthOnCollectionStack();
1093: int peekCP = peekCodePoint();
1094:
1095: while (peekCP != Reply.END_OF_COLLECTION) {
1096:
1097: boolean foundInPass = false;
1098:
1099: if (peekCP == CodePoint.SVRCOD) {
1100: foundInPass = true;
1101: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
1102: svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR,
1103: CodePoint.SVRCOD_ERROR);
1104: peekCP = peekCodePoint();
1105: }
1106:
1107: if (peekCP == CodePoint.RDBNAM) {
1108: foundInPass = true;
1109: rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
1110: rdbnam = parseRDBNAM(true);
1111: peekCP = peekCodePoint();
1112: }
1113:
1114: if (!foundInPass) {
1115: doPrmnsprmSemantics(peekCP);
1116: }
1117:
1118: }
1119: popCollectionStack();
1120: checkRequiredObjects(svrcodReceived, rdbnamReceived);
1121:
1122: netAgent_.setSvrcod(svrcod);
1123: netAgent_
1124: .accumulateReadException(new SqlException(
1125: agent_.logWriter_,
1126: new ClientMessageId(
1127: SQLState.NET_CONNECT_AUTH_FAILED),
1128: msgutil_
1129: .getTextMessage(MessageId.CONN_USER_NOT_AUTHORIZED_TO_DB)));
1130: }
1131:
1132: // Data Stream Syntax Error Reply Message indicates that the data
1133: // sent to the target agent does not structurally conform to the requirements
1134: // of the DDM architecture. The target agent terminated paring of the DSS
1135: // when the condition SYNERRCD specified was detected.
1136: // PROTOCOL architects an SQLSTATE of 58008 or 58009.
1137: //
1138: // Messages
1139: // SQLSTATE : 58009
1140: // Execution failed due to a distribution protocol error that caused deallocation of the conversation.
1141: // SQLCODE : -30020
1142: // Execution failed because of a Distributed Protocol
1143: // Error that will affect the successful execution of subsequent
1144: // commands and SQL statements: Reason Code <reason-code>.
1145: // Some possible reason codes include:
1146: // 121C Indicates that the user is not authorized to perform the requested command.
1147: // 1232 The command could not be completed because of a permanent error.
1148: // In most cases, the server will be in the process of an abend.
1149: // 220A The target server has received an invalid data description.
1150: // If a user SQLDA is specified, ensure that the fields are
1151: // initialized correctly. Also, ensure that the length does not
1152: // exceed the maximum allowed length for the data type being used.
1153: //
1154: // The command or statement cannot be processed. The current
1155: // transaction is rolled back and the application is disconnected
1156: // from the remote database.
1157: //
1158: //
1159: // Returned from Server:
1160: // SVRCOD - required (8 - ERROR)
1161: // SYNERRCD - required
1162: // RECCNT - optional (MINVAL 0, MINLVL 3) (will not be returned - should be ignored)
1163: // CODPNT - optional (MINLVL 3)
1164: // RDBNAM - optional (MINLVL 3)
1165: //
1166: protected void parseSYNTAXRM() throws DisconnectException {
1167: boolean svrcodReceived = false;
1168: int svrcod = CodePoint.SVRCOD_INFO;
1169: boolean synerrcdReceived = false;
1170: int synerrcd = 0;
1171: boolean rdbnamReceived = false;
1172: String rdbnam = null;
1173: boolean codpntReceived = false;
1174: int codpnt = 0;
1175:
1176: parseLengthAndMatchCodePoint(CodePoint.SYNTAXRM);
1177: pushLengthOnCollectionStack();
1178: int peekCP = peekCodePoint();
1179:
1180: while (peekCP != Reply.END_OF_COLLECTION) {
1181:
1182: boolean foundInPass = false;
1183:
1184: if (peekCP == CodePoint.SVRCOD) {
1185: foundInPass = true;
1186: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
1187: svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR,
1188: CodePoint.SVRCOD_ERROR);
1189: peekCP = peekCodePoint();
1190: }
1191:
1192: if (peekCP == CodePoint.SYNERRCD) {
1193: foundInPass = true;
1194: synerrcdReceived = checkAndGetReceivedFlag(synerrcdReceived);
1195: synerrcd = parseSYNERRCD();
1196: peekCP = peekCodePoint();
1197: }
1198:
1199: if (peekCP == CodePoint.RDBNAM) {
1200: foundInPass = true;
1201: rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
1202: rdbnam = parseRDBNAM(true);
1203: peekCP = peekCodePoint();
1204: }
1205:
1206: if (peekCP == CodePoint.CODPNT) {
1207: foundInPass = true;
1208: codpntReceived = checkAndGetReceivedFlag(codpntReceived);
1209: codpnt = parseCODPNT();
1210: peekCP = peekCodePoint();
1211: }
1212:
1213: // RECCNT will be skipped.
1214:
1215: if (!foundInPass) {
1216: doPrmnsprmSemantics(peekCP);
1217: }
1218: }
1219: popCollectionStack();
1220: checkRequiredObjects(svrcodReceived, synerrcdReceived);
1221:
1222: netAgent_.setSvrcod(svrcod);
1223: doSyntaxrmSemantics(codpnt);
1224: }
1225:
1226: // RDB Currently Accessed Reply Message inidcates that the
1227: // ACCRDB command cannot be issued because the requester
1228: // has access to a relational database.
1229: // PROTOCOL architects an SQLSTATE of 58008 or 58009.
1230: //
1231: // Messages
1232: // SQLSTATE : 58009
1233: // Execution failed due to a distribution protocol error that caused deallocation of the conversation.
1234: // SQLCODE : -30020
1235: // Execution failed because of a Distributed Protocol
1236: // Error that will affect the successful execution of subsequent
1237: // commands and SQL statements: Reason Code <reason-code>.
1238: // Some possible reason codes include:
1239: // 121C Indicates that the user is not authorized to perform the requested command.
1240: // 1232 The command could not be completed because of a permanent error.
1241: // In most cases, the server will be in the process of an abend.
1242: // 220A The target server has received an invalid data description.
1243: // If a user SQLDA is specified, ensure that the fields are
1244: // initialized correctly. Also, ensure that the length does not
1245: // exceed the maximum allowed length for the data type being used.
1246: //
1247: // The command or statement cannot be processed. The current
1248: // transaction is rolled back and the application is disconnected
1249: // from the remote database.
1250: //
1251: //
1252: // Returned from Server:
1253: // SVRCOD - required (8 - ERROR)
1254: // RDBNAM - required
1255: //
1256: private void parseRDBACCRM() throws DisconnectException {
1257: boolean svrcodReceived = false;
1258: int svrcod = CodePoint.SVRCOD_INFO;
1259: boolean rdbnamReceived = false;
1260: String rdbnam = null;
1261:
1262: parseLengthAndMatchCodePoint(CodePoint.RDBACCRM);
1263: pushLengthOnCollectionStack();
1264: int peekCP = peekCodePoint();
1265:
1266: while (peekCP != Reply.END_OF_COLLECTION) {
1267:
1268: boolean foundInPass = false;
1269:
1270: if (peekCP == CodePoint.SVRCOD) {
1271: foundInPass = true;
1272: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
1273: svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR,
1274: CodePoint.SVRCOD_ERROR);
1275: peekCP = peekCodePoint();
1276: }
1277:
1278: if (peekCP == CodePoint.RDBNAM) {
1279: foundInPass = true;
1280: rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
1281: rdbnam = parseRDBNAM(true);
1282: peekCP = peekCodePoint();
1283: }
1284:
1285: if (!foundInPass) {
1286: doPrmnsprmSemantics(peekCP);
1287: }
1288:
1289: }
1290: popCollectionStack();
1291: checkRequiredObjects(svrcodReceived, rdbnamReceived);
1292:
1293: netAgent_.setSvrcod(svrcod);
1294: agent_
1295: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
1296: agent_,
1297: new ClientMessageId(
1298: SQLState.DRDA_CONNECTION_TERMINATED),
1299: msgutil_
1300: .getTextMessage(MessageId.CONN_DRDA_RDBACCRM)));
1301: }
1302:
1303: // RDB Access Failed Reply Message specifies that the relational
1304: // database failed the attempted connection.
1305: // An SQLCARD object must also be returned, following the
1306: // RDBAFLRM, to explain why the RDB failed the connection.
1307: // In addition, the target SQLAM instance is destroyed.
1308: // The SQLSTATE is returned in the SQLCARD.
1309: //
1310: // Messages
1311: // SQLSTATE : 58009
1312: // Execution failed due to a distribution protocol error that caused deallocation of the conversation.
1313: // SQLCODE : -30020
1314: // Execution failed because of a Distributed Protocol
1315: // Error that will affect the successful execution of subsequent
1316: // commands and SQL statements: Reason Code <reason-code>.
1317: // Some possible reason codes include:
1318: // 121C Indicates that the user is not authorized to perform the requested command.
1319: // 1232 The command could not be completed because of a permanent error.
1320: // In most cases, the server will be in the process of an abend.
1321: // 220A The target server has received an invalid data description.
1322: // If a user SQLDA is specified, ensure that the fields are
1323: // initialized correctly. Also, ensure that the length does not
1324: // exceed the maximum allowed length for the data type being used.
1325: //
1326: // The command or statement cannot be processed. The current
1327: // transaction is rolled back and the application is disconnected
1328: // from the remote database.
1329: //
1330: //
1331: // Returned from Server:
1332: // SVRCOD - required (8 - ERROR)
1333: // RDBNAM - required
1334: //
1335: private void parseRDBAFLRM() throws DisconnectException {
1336: boolean svrcodReceived = false;
1337: int svrcod = CodePoint.SVRCOD_INFO;
1338: boolean rdbnamReceived = false;
1339: String rdbnam = null;
1340:
1341: parseLengthAndMatchCodePoint(CodePoint.RDBAFLRM);
1342: pushLengthOnCollectionStack();
1343: int peekCP = peekCodePoint();
1344:
1345: while (peekCP != Reply.END_OF_COLLECTION) {
1346:
1347: boolean foundInPass = false;
1348:
1349: if (peekCP == CodePoint.SVRCOD) {
1350: foundInPass = true;
1351: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
1352: svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR,
1353: CodePoint.SVRCOD_ERROR);
1354: peekCP = peekCodePoint();
1355: }
1356:
1357: if (peekCP == CodePoint.RDBNAM) {
1358: foundInPass = true;
1359: rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
1360: rdbnam = parseRDBNAM(true);
1361: peekCP = peekCodePoint();
1362: }
1363:
1364: if (!foundInPass) {
1365: doPrmnsprmSemantics(peekCP);
1366: }
1367:
1368: }
1369: popCollectionStack();
1370: checkRequiredObjects(svrcodReceived, rdbnamReceived);
1371:
1372: netAgent_.setSvrcod(svrcod);
1373: }
1374:
1375: // Parameter Value Not Supported Reply Message indicates
1376: // that the parameter value specified is either not recognized
1377: // or not supported for the specified parameter.
1378: // The VALNSPRM can only be specified in accordance with
1379: // the rules specified for DDM subsetting.
1380: // The code point of the command parameter in error is
1381: // returned as a parameter in this message.
1382: // PROTOCOL Architects an SQLSTATE of 58017.
1383: //
1384: // if codepoint is 0x119C,0x119D, or 0x119E then SQLSTATE 58017, SQLCODE -332
1385: // else SQLSTATE 58017, SQLCODE -30073
1386: //
1387: // Messages
1388: // SQLSTATE : 58017
1389: // The DDM parameter value is not supported.
1390: // SQLCODE : -332
1391: // There is no available conversion for the source code page
1392: // <code page> to the target code page <code page>.
1393: // Reason code <reason-code>.
1394: // The reason codes are as follows:
1395: // 1 source and target code page combination is not supported
1396: // by the database manager.
1397: // 2 source and target code page combination is either not
1398: // supported by the database manager or by the operating
1399: // system character conversion utility on the client node.
1400: // 3 source and target code page combination is either not
1401: // supported by the database manager or by the operating
1402: // system character conversion utility on the server node.
1403: //
1404: // SQLSTATE : 58017
1405: // The DDM parameter value is not supported.
1406: // SQLCODE : -30073
1407: // <parameter-identifier> Parameter value <value> is not supported.
1408: // Some possible parameter identifiers include:
1409: // 002F The target server does not support the data type
1410: // requested by the application requester.
1411: // The target server does not support the CCSID
1412: // requested by the application requester. Ensure the CCSID
1413: // used by the requester is supported by the server.
1414: // 119C - Verify the single-byte CCSID.
1415: // 119D - Verify the double-byte CCSID.
1416: // 119E - Verify the mixed-byte CCSID.
1417: //
1418: // The current environment command or SQL statement
1419: // cannot be processed successfully, nor can any subsequent
1420: // commands or SQL statements. The current transaction is
1421: // rolled back and the application is disconnected
1422: // from the remote database. The command cannot be processed.
1423: //
1424: // Returned from Server:
1425: // SVRCOD - required (8 - ERROR)
1426: // CODPNT - required
1427: // RECCNT - optional (MINLVL 3, MINVAL 0) (will not be returned - should be ignored)
1428: // RDBNAM - optional (MINLVL 3)
1429: //
1430: protected void parseVALNSPRM() throws DisconnectException {
1431: boolean svrcodReceived = false;
1432: int svrcod = CodePoint.SVRCOD_INFO;
1433: boolean rdbnamReceived = false;
1434: String rdbnam = null;
1435: boolean codpntReceived = false;
1436: int codpnt = 0;
1437:
1438: parseLengthAndMatchCodePoint(CodePoint.VALNSPRM);
1439: pushLengthOnCollectionStack();
1440: int peekCP = peekCodePoint();
1441:
1442: while (peekCP != Reply.END_OF_COLLECTION) {
1443:
1444: boolean foundInPass = false;
1445:
1446: if (peekCP == CodePoint.SVRCOD) {
1447: foundInPass = true;
1448: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
1449: svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR,
1450: CodePoint.SVRCOD_ERROR);
1451: peekCP = peekCodePoint();
1452: }
1453:
1454: if (peekCP == CodePoint.RDBNAM) {
1455: foundInPass = true;
1456: rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
1457: rdbnam = parseRDBNAM(true);
1458: peekCP = peekCodePoint();
1459: }
1460:
1461: if (peekCP == CodePoint.CODPNT) {
1462: foundInPass = true;
1463: codpntReceived = checkAndGetReceivedFlag(codpntReceived);
1464: codpnt = parseCODPNT();
1465: peekCP = peekCodePoint();
1466: }
1467:
1468: // RECCNT will be skipped
1469:
1470: if (!foundInPass) {
1471: doPrmnsprmSemantics(peekCP);
1472: }
1473:
1474: }
1475: popCollectionStack();
1476: checkRequiredObjects(svrcodReceived, codpntReceived);
1477:
1478: netAgent_.setSvrcod(svrcod);
1479: doValnsprmSemantics(codpnt, "\"\"");
1480: }
1481:
1482: // Conversational Protocol Error Reply Message
1483: // indicates that a conversational protocol error occurred.
1484: // PROTOCOL architects the SQLSTATE value depending on SVRCOD
1485: // SVRCOD 8 -> SQLSTATE of 58008 or 58009
1486: // SVRCOD 16,128 -> SQLSTATE of 58009
1487: //
1488: // Messages
1489: // SQLSTATE : 58009
1490: // Execution failed due to a distribution protocol error that caused deallocation of the conversation.
1491: // SQLCODE : -30020
1492: // Execution failed because of a Distributed Protocol
1493: // Error that will affect the successful execution of subsequent
1494: // commands and SQL statements: Reason Code <reason-code>.
1495: // Some possible reason codes include:
1496: // 121C Indicates that the user is not authorized to perform the requested command.
1497: // 1232 The command could not be completed because of a permanent error.
1498: // In most cases, the server will be in the process of an abend.
1499: // 220A The target server has received an invalid data description.
1500: // If a user SQLDA is specified, ensure that the fields are
1501: // initialized correctly. Also, ensure that the length does not
1502: // exceed the maximum allowed length for the data type being used.
1503: //
1504: // The command or statement cannot be processed. The current
1505: // transaction is rolled back and the application is disconnected
1506: // from the remote database.
1507: //
1508: //
1509: // Returned from Server:
1510: // SVRCOD - required (8 - ERROR, 16 - SEVERE, 128 - SESDMG)
1511: // PRCCNVCD - required
1512: // RECCNT - optional (MINVAL 0, MINLVL 3)
1513: // RDBNAM - optional (NINLVL 3)
1514: //
1515: protected void parsePRCCNVRM() throws DisconnectException {
1516: boolean svrcodReceived = false;
1517: int svrcod = CodePoint.SVRCOD_INFO;
1518: boolean rdbnamReceived = false;
1519: String rdbnam = null;
1520: boolean prccnvcdReceived = false;
1521: int prccnvcd = 0;
1522:
1523: parseLengthAndMatchCodePoint(CodePoint.PRCCNVRM);
1524: pushLengthOnCollectionStack();
1525: int peekCP = peekCodePoint();
1526:
1527: while (peekCP != Reply.END_OF_COLLECTION) {
1528:
1529: boolean foundInPass = false;
1530:
1531: if (peekCP == CodePoint.SVRCOD) {
1532: foundInPass = true;
1533: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
1534: svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR,
1535: CodePoint.SVRCOD_SESDMG);
1536: peekCP = peekCodePoint();
1537: }
1538:
1539: if (peekCP == CodePoint.RDBNAM) {
1540: foundInPass = true;
1541: rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
1542: rdbnam = parseRDBNAM(true);
1543: peekCP = peekCodePoint();
1544: }
1545:
1546: if (peekCP == CodePoint.PRCCNVCD) {
1547: foundInPass = true;
1548: prccnvcdReceived = checkAndGetReceivedFlag(prccnvcdReceived);
1549: prccnvcd = parsePRCCNVCD();
1550: peekCP = peekCodePoint();
1551: }
1552:
1553: if (!foundInPass) {
1554: doPrmnsprmSemantics(peekCP);
1555: }
1556:
1557: }
1558: popCollectionStack();
1559: checkRequiredObjects(svrcodReceived, prccnvcdReceived);
1560:
1561: netAgent_.setSvrcod(svrcod);
1562: doPrccnvrmSemantics(CodePoint.PRCCNVRM);
1563: }
1564:
1565: // Object Not Supported Reply Message indicates that the target
1566: // server does not recognize or support the object
1567: // specified as data in an OBJDSS for the command associated
1568: // with the object.
1569: // The OBJNSPRM is also returned if an object is found in a
1570: // valid collection in an OBJDSS (such as RECAL collection)
1571: // that that is not valid for that collection.
1572: // PROTOCOL Architects an SQLSTATE of 58015.
1573: //
1574: // Messages
1575: // SQLSTATE : 58015
1576: // The DDM object is not supported.
1577: // SQLCODE : -30071
1578: // <object-identifier> Object is not supported.
1579: // The current transaction is rolled back and the application
1580: // is disconnected from the remote database. The command
1581: // cannot be processed.
1582: //
1583: //
1584: // Returned from Server:
1585: // SVRCOD - required (8 - ERROR, 16 - SEVERE)
1586: // CODPNT - required
1587: // RECCNT - optional (MINVAL 0) (will not be returned - should be ignored)
1588: // RDBNAM - optional (MINLVL 3)
1589: //
1590: // Also called by NetPackageReply and NetStatementReply
1591: void parseOBJNSPRM() throws DisconnectException {
1592: boolean svrcodReceived = false;
1593: int svrcod = CodePoint.SVRCOD_INFO;
1594: boolean rdbnamReceived = false;
1595: String rdbnam = null;
1596: boolean codpntReceived = false;
1597: int codpnt = 0;
1598:
1599: parseLengthAndMatchCodePoint(CodePoint.OBJNSPRM);
1600: pushLengthOnCollectionStack();
1601: int peekCP = peekCodePoint();
1602:
1603: while (peekCP != Reply.END_OF_COLLECTION) {
1604:
1605: boolean foundInPass = false;
1606:
1607: if (peekCP == CodePoint.SVRCOD) {
1608: foundInPass = true;
1609: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
1610: svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR,
1611: CodePoint.SVRCOD_SEVERE);
1612: peekCP = peekCodePoint();
1613: }
1614:
1615: if (peekCP == CodePoint.RDBNAM) {
1616: foundInPass = true;
1617: rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
1618: rdbnam = parseRDBNAM(true);
1619: peekCP = peekCodePoint();
1620: }
1621:
1622: if (peekCP == CodePoint.CODPNT) {
1623: foundInPass = true;
1624: codpntReceived = checkAndGetReceivedFlag(codpntReceived);
1625: codpnt = parseCODPNT();
1626: peekCP = peekCodePoint();
1627: }
1628:
1629: // skip the RECCNT
1630:
1631: if (!foundInPass) {
1632: doPrmnsprmSemantics(peekCP);
1633: }
1634:
1635: }
1636: popCollectionStack();
1637: checkRequiredObjects(svrcodReceived, codpntReceived);
1638:
1639: netAgent_.setSvrcod(svrcod);
1640: doObjnsprmSemantics(codpnt);
1641: }
1642:
1643: // Manager-Level Conflict (MGRLVLRM) Reply Message indicates that
1644: // the manager levels specified in the MGRLVLLS conflict amoung
1645: // themselves or with previously specified manager levels.
1646: // - The manager-level dependencies of one specified manager violates another
1647: // specified maanger level.
1648: // - The manager- level specified attempts to respecify a manager level that
1649: // previously EXCSAT command specified.
1650: // PROTOCOL architects an SQLSTATE of 58010.
1651: //
1652: // Messages
1653: // SQLSTATE : 58010
1654: // Execution failed due to a distributed protocol error that will affect
1655: // the successful execution of subsequent DDM commands or SQL statements.
1656: // SQLCODE : -30021
1657: // Execution failed due to a distribution protocol error
1658: // that will affect the successful execution of subsequent
1659: // commands and SQL statements: Manager <manager> at Level <level>
1660: // not supported.
1661: //
1662: // A system error occurred that prevented successful connection
1663: // of the application to the remote database.
1664: //
1665: //
1666: // Returned from Server:
1667: // SVRCOD - required (8 - ERROR)
1668: // MGRLVLLS - required
1669: //
1670: private void parseMGRLVLRM() throws DisconnectException {
1671: boolean svrcodReceived = false;
1672: int svrcod = CodePoint.SVRCOD_INFO;
1673: boolean mgrlvllsReceived = false;
1674: int[] managerCodePoint = null;
1675: int[] managerLevel = null;
1676:
1677: parseLengthAndMatchCodePoint(CodePoint.MGRLVLRM);
1678: pushLengthOnCollectionStack();
1679: int peekCP = peekCodePoint();
1680:
1681: while (peekCP != Reply.END_OF_COLLECTION) {
1682:
1683: boolean foundInPass = false;
1684:
1685: if (peekCP == CodePoint.SVRCOD) {
1686: foundInPass = true;
1687: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
1688: svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR,
1689: CodePoint.SVRCOD_ERROR);
1690: peekCP = peekCodePoint();
1691: }
1692:
1693: if (peekCP == CodePoint.MGRLVLLS) {
1694: foundInPass = true;
1695: mgrlvllsReceived = checkAndGetReceivedFlag(mgrlvllsReceived);
1696:
1697: parseLengthAndMatchCodePoint(CodePoint.MGRLVLLS);
1698: int managerListLength = getDdmLength();
1699: if ((managerListLength == 0)
1700: || ((managerListLength % 7) != 0)) {
1701: doSyntaxrmSemantics(CodePoint.SYNERRCD_OBJ_LEN_NOT_ALLOWED);
1702: }
1703:
1704: int managerCount = managerListLength / 7;
1705: managerCodePoint = new int[managerCount];
1706: managerLevel = new int[managerCount];
1707: for (int i = 0; i < managerCount; i++) {
1708: managerCodePoint[i] = parseCODPNTDR();
1709: managerLevel[i] = parseMGRLVLN();
1710: }
1711: peekCP = peekCodePoint();
1712: }
1713:
1714: if (!foundInPass) {
1715: doPrmnsprmSemantics(peekCP);
1716: }
1717:
1718: }
1719: popCollectionStack();
1720: checkRequiredObjects(svrcodReceived, mgrlvllsReceived);
1721:
1722: netAgent_.setSvrcod(svrcod);
1723: doMgrlvlrmSemantics(managerCodePoint, managerLevel);
1724: }
1725:
1726: // Command Not Supported Reply Message indicates that the specified
1727: // command is not recognized or not supported for the
1728: // specified target. The reply message can be returned
1729: // only in accordance with the architected rules for DDM subsetting.
1730: // PROTOCOL architects an SQLSTATE of 58014.
1731: //
1732: // Messages
1733: // SQLSTATE : 58014
1734: // The DDM command is not supported.
1735: // SQLCODE : -30070
1736: // <command-identifier> Command is not supported.
1737: // The current transaction is rolled back and the application is
1738: // disconnected from the remote database. The statement cannot be processed.
1739: //
1740: //
1741: // Returned from Server:
1742: // SVRCOD - required (4 - WARNING, 8 - ERROR) (MINLVL 2)
1743: // CODPNT - required
1744: // RDBNAM - optional (MINLVL 3)
1745: //
1746: protected void parseCMDNSPRM() throws DisconnectException {
1747: boolean svrcodReceived = false;
1748: int svrcod = CodePoint.SVRCOD_INFO;
1749: boolean rdbnamReceived = false;
1750: String rdbnam = null;
1751: boolean srvdgnReceived = false;
1752: byte[] srvdgn = null;
1753: boolean codpntReceived = false;
1754: int codpnt = 0;
1755:
1756: parseLengthAndMatchCodePoint(CodePoint.CMDNSPRM);
1757: pushLengthOnCollectionStack();
1758: int peekCP = peekCodePoint();
1759:
1760: while (peekCP != Reply.END_OF_COLLECTION) {
1761:
1762: boolean foundInPass = false;
1763:
1764: if (peekCP == CodePoint.SVRCOD) {
1765: foundInPass = true;
1766: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
1767: svrcod = parseSVRCOD(CodePoint.SVRCOD_WARNING,
1768: CodePoint.SVRCOD_ERROR);
1769: peekCP = peekCodePoint();
1770: }
1771:
1772: if (peekCP == CodePoint.RDBNAM) {
1773: foundInPass = true;
1774: rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
1775: rdbnam = parseRDBNAM(true);
1776: peekCP = peekCodePoint();
1777: }
1778:
1779: if (peekCP == CodePoint.CODPNT) {
1780: foundInPass = true;
1781: codpntReceived = checkAndGetReceivedFlag(codpntReceived);
1782: codpnt = parseCODPNT();
1783: peekCP = peekCodePoint();
1784: }
1785:
1786: if (!foundInPass) {
1787: doPrmnsprmSemantics(peekCP);
1788: }
1789:
1790: }
1791: popCollectionStack();
1792: checkRequiredObjects(svrcodReceived, codpntReceived);
1793:
1794: netAgent_.setSvrcod(svrcod);
1795: agent_
1796: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
1797: agent_,
1798: new ClientMessageId(
1799: SQLState.DRDA_DDM_COMMAND_NOT_SUPPORTED),
1800: Integer.toHexString(codpnt)));
1801: }
1802:
1803: // Abnormal End Unit of Work Condition Reply Message indicates
1804: // that the current unit of work ended abnormally because
1805: // of some action at the target server. This can be caused by a
1806: // deadlock resolution, operator intervention, or some similar
1807: // situation that caused the relational database to rollback
1808: // the current unit of work. This reply message is returned only
1809: // if an SQLAM issues the command. Whenever an ABNUOWRM is returned
1810: // in response to a command, an SQLCARD object must also be returned
1811: // following the ABNUOWRM. The SQLSTATE is returned in the SQLCARD.
1812: //
1813: // Returned from Server:
1814: // SVRCOD - required (8 - ERROR)
1815: // RDBNAM - required
1816: //
1817: // Called by all the NET*Reply classes.
1818: void parseABNUOWRM() throws DisconnectException {
1819: boolean svrcodReceived = false;
1820: int svrcod = CodePoint.SVRCOD_INFO;
1821: boolean rdbnamReceived = false;
1822: String rdbnam = null;
1823:
1824: parseLengthAndMatchCodePoint(CodePoint.ABNUOWRM);
1825: pushLengthOnCollectionStack();
1826: int peekCP = peekCodePoint();
1827:
1828: while (peekCP != Reply.END_OF_COLLECTION) {
1829:
1830: boolean foundInPass = false;
1831:
1832: if (peekCP == CodePoint.SVRCOD) {
1833: foundInPass = true;
1834: svrcodReceived = checkAndGetReceivedFlag(svrcodReceived);
1835: svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR,
1836: CodePoint.SVRCOD_ERROR);
1837: peekCP = peekCodePoint();
1838: }
1839:
1840: if (peekCP == CodePoint.RDBNAM) {
1841: // skip the rbbnam since it doesn't tell us anything new.
1842: // there is no way to return it to the application anyway.
1843: // not having to convert this to a string is a time saver also.
1844: foundInPass = true;
1845: rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
1846: rdbnam = parseRDBNAM(true);
1847: peekCP = peekCodePoint();
1848: }
1849:
1850: if (!foundInPass) {
1851: doPrmnsprmSemantics(peekCP);
1852: }
1853: }
1854:
1855: popCollectionStack();
1856: checkRequiredObjects(svrcodReceived, rdbnamReceived);
1857:
1858: // the abnuowrm has been received, do whatever state changes are necessary
1859: netAgent_.setSvrcod(svrcod);
1860: }
1861:
1862: //--------------------- parse DDM Reply Data--------------------------------------
1863:
1864: // The Server Attributes Reply Data (EXCSATRD) returns the following
1865: // information in response to an EXCSAT command:
1866: // - the target server's class name
1867: // - the target server's support level for each class of manager
1868: // the source requests
1869: // - the target server's product release level
1870: // - the target server's external name
1871: // - the target server's name
1872: //
1873: // Returned from Server:
1874: // EXTNAM - optional
1875: // MGRLVLLS - optional
1876: // SRVCLSNM - optional
1877: // SRVNAM - optional
1878: // SRVRLSLV - optional
1879: private void parseEXCSATRD(NetConnection netConnection)
1880: throws DisconnectException {
1881: boolean extnamReceived = false;
1882: String extnam = null;
1883: boolean mgrlvllsReceived = false;
1884: boolean srvclsnmReceived = false;
1885: String srvclsnm = null;
1886: boolean srvnamReceived = false;
1887: String srvnam = null;
1888: boolean srvrlslvReceived = false;
1889: String srvrlslv = null;
1890:
1891: parseLengthAndMatchCodePoint(CodePoint.EXCSATRD);
1892: pushLengthOnCollectionStack();
1893: int peekCP = peekCodePoint();
1894:
1895: while (peekCP != Reply.END_OF_COLLECTION) {
1896:
1897: boolean foundInPass = false;
1898:
1899: if (peekCP == CodePoint.EXTNAM) {
1900: // External Name is the name of the job, task, or process
1901: // on a system for which a DDM server is active. For a target
1902: // DDM server, the external name is the name of the job the system creates
1903: // or activates to run the DDM server.
1904: // No semantic meaning is assigned to external names in DDM.
1905: // External names are transmitted to aid in problem determination.
1906: // This driver will save the external name of the target (the
1907: // driver may use it for logging purposes later).
1908: foundInPass = true;
1909: extnamReceived = checkAndGetReceivedFlag(extnamReceived);
1910: extnam = parseEXTNAM();
1911: peekCP = peekCodePoint();
1912: }
1913:
1914: if (peekCP == CodePoint.MGRLVLLS) {
1915: // Manager-Level List
1916: // specifies a list of code points and support levels for the
1917: // classes of managers a server supports
1918: foundInPass = true;
1919: mgrlvllsReceived = checkAndGetReceivedFlag(mgrlvllsReceived);
1920: parseMGRLVLLS(netConnection); // need to review this one, check input and output
1921: peekCP = peekCodePoint();
1922: }
1923:
1924: if (peekCP == CodePoint.SRVCLSNM) {
1925: // Server Class Name
1926: // specifies the name of a class of ddm servers.
1927: foundInPass = true;
1928: srvclsnmReceived = checkAndGetReceivedFlag(srvclsnmReceived);
1929: srvclsnm = parseSRVCLSNM();
1930: peekCP = peekCodePoint();
1931: }
1932:
1933: if (peekCP == CodePoint.SRVNAM) {
1934: // Server Name
1935: // no semantic meaning is assigned to server names in DDM,
1936: // it is recommended (by the DDM manual) that the server's
1937: // physical or logical location identifier be used as a server name.
1938: // server names are transmitted for problem determination purposes.
1939: // this driver will save this name and in the future may use it
1940: // for logging errors.
1941: foundInPass = true;
1942: srvnamReceived = checkAndGetReceivedFlag(srvnamReceived);
1943: srvnam = parseSRVNAM();
1944: peekCP = peekCodePoint();
1945: }
1946:
1947: if (peekCP == CodePoint.SRVRLSLV) {
1948: // Server Product Release Level
1949: // specifies the procuct release level of a ddm server.
1950: // the contents are unarchitected.
1951: // this driver will save this information and in the future may
1952: // use it for logging purposes.
1953: foundInPass = true;
1954: srvrlslvReceived = checkAndGetReceivedFlag(srvrlslvReceived);
1955: srvrlslv = parseSRVRLSLV();
1956: peekCP = peekCodePoint();
1957: }
1958:
1959: if (!foundInPass) {
1960: doPrmnsprmSemantics(peekCP);
1961: }
1962:
1963: }
1964: popCollectionStack();
1965: // according the the DDM book, all these instance variables are optional
1966: netConnection.setServerAttributeData(extnam, srvclsnm, srvnam,
1967: srvrlslv);
1968: }
1969:
1970: // Must make a version that does not change state in the associated connection
1971: private void parseDummyEXCSATRD(NetConnection netConnection)
1972: throws DisconnectException {
1973: boolean extnamReceived = false;
1974: String extnam = null;
1975: boolean mgrlvllsReceived = false;
1976: boolean srvclsnmReceived = false;
1977: String srvclsnm = null;
1978: boolean srvnamReceived = false;
1979: String srvnam = null;
1980: boolean srvrlslvReceived = false;
1981: String srvrlslv = null;
1982:
1983: parseLengthAndMatchCodePoint(CodePoint.EXCSATRD);
1984: pushLengthOnCollectionStack();
1985: int peekCP = peekCodePoint();
1986:
1987: while (peekCP != Reply.END_OF_COLLECTION) {
1988:
1989: boolean foundInPass = false;
1990:
1991: if (peekCP == CodePoint.EXTNAM) {
1992: // External Name is the name of the job, task, or process
1993: // on a system for which a DDM server is active. For a target
1994: // DDM server, the external name is the name of the job the system creates
1995: // or activates to run the DDM server.
1996: // No semantic meaning is assigned to external names in DDM.
1997: // External names are transmitted to aid in problem determination.
1998: // This driver will save the external name of the target (the
1999: // driver may use it for logging purposes later).
2000: foundInPass = true;
2001: extnamReceived = checkAndGetReceivedFlag(extnamReceived);
2002: extnam = parseEXTNAM();
2003: peekCP = peekCodePoint();
2004: }
2005:
2006: if (peekCP == CodePoint.MGRLVLLS) {
2007: // Manager-Level List
2008: // specifies a list of code points and support levels for the
2009: // classes of managers a server supports
2010: foundInPass = true;
2011: mgrlvllsReceived = checkAndGetReceivedFlag(mgrlvllsReceived);
2012: parseMGRLVLLS(netConnection); // need to review this one, check input and output
2013: peekCP = peekCodePoint();
2014: }
2015:
2016: if (peekCP == CodePoint.SRVCLSNM) {
2017: // Server Class Name
2018: // specifies the name of a class of ddm servers.
2019: foundInPass = true;
2020: srvclsnmReceived = checkAndGetReceivedFlag(srvclsnmReceived);
2021: srvclsnm = parseSRVCLSNM();
2022: peekCP = peekCodePoint();
2023: }
2024:
2025: if (peekCP == CodePoint.SRVNAM) {
2026: // Server Name
2027: // no semantic meaning is assigned to server names in DDM,
2028: // it is recommended (by the DDM manual) that the server's
2029: // physical or logical location identifier be used as a server name.
2030: // server names are transmitted for problem determination purposes.
2031: // this driver will save this name and in the future may use it
2032: // for logging errors.
2033: foundInPass = true;
2034: srvnamReceived = checkAndGetReceivedFlag(srvnamReceived);
2035: srvnam = parseSRVNAM();
2036: peekCP = peekCodePoint();
2037: }
2038:
2039: if (peekCP == CodePoint.SRVRLSLV) {
2040: // Server Product Release Level
2041: // specifies the procuct release level of a ddm server.
2042: // the contents are unarchitected.
2043: // this driver will save this information and in the future may
2044: // use it for logging purposes.
2045: foundInPass = true;
2046: srvrlslvReceived = checkAndGetReceivedFlag(srvrlslvReceived);
2047: srvrlslv = parseSRVRLSLV();
2048: peekCP = peekCodePoint();
2049: }
2050:
2051: if (!foundInPass) {
2052: doPrmnsprmSemantics(peekCP);
2053: }
2054:
2055: }
2056: popCollectionStack();
2057: // according the the DDM book, all these instance variables are optional
2058: // don't change state of netConnection because this is a DUMMY flow
2059: //netConnection.setServerAttributeData (extnam, srvclsnm, srvnam, srvrlslv);
2060: }
2061:
2062: // The Access Security Reply Data (ACSECRD) Collection Object contains
2063: // the security information from a target server's security manager.
2064: // this method returns the security check code received from the server
2065: // (if the server does not return a security check code, this method
2066: // will return 0). it is up to the caller to check
2067: // the value of this return code and take the appropriate action.
2068: //
2069: // Returned from Server:
2070: // SECMEC - required
2071: // SECTKN - optional (MINLVL 6)
2072: // SECCHKCD - optional
2073: private void parseACCSECRD(NetConnection netConnection,
2074: int securityMechanism) throws DisconnectException {
2075: boolean secmecReceived = false;
2076: int[] secmecList = null;
2077: boolean sectknReceived = false;
2078: byte[] sectkn = null;
2079: boolean secchkcdReceived = false;
2080: int secchkcd = 0;
2081:
2082: parseLengthAndMatchCodePoint(CodePoint.ACCSECRD);
2083: pushLengthOnCollectionStack();
2084: int peekCP = peekCodePoint();
2085:
2086: while (peekCP != Reply.END_OF_COLLECTION) {
2087:
2088: boolean foundInPass = false;
2089:
2090: if (peekCP == CodePoint.SECMEC) {
2091: // security mechanism.
2092: // this value must either reflect the value sent in the ACCSEC command
2093: // if the target server supports it; or the values the target server
2094: // does support when it does not support or accept the value
2095: // requested by the source server.
2096: // the secmecs returned are treated as a list and stored in
2097: // targetSecmec_List.
2098: // if the target server supports the source's secmec, it
2099: // will be saved in the variable targetSecmec_ (NOTE: so
2100: // after calling this method, if targetSecmec_'s value is zero,
2101: // then the target did NOT support the source secmec. any alternate
2102: // secmecs would be contained in targetSecmec_List).
2103: foundInPass = true;
2104: secmecReceived = checkAndGetReceivedFlag(secmecReceived);
2105: secmecList = parseSECMEC();
2106: peekCP = peekCodePoint();
2107: }
2108:
2109: if (peekCP == CodePoint.SECTKN) {
2110: // security token
2111: foundInPass = true;
2112: sectknReceived = checkAndGetReceivedFlag(sectknReceived);
2113: sectkn = parseSECTKN(false);
2114: peekCP = peekCodePoint();
2115: }
2116:
2117: if (peekCP == CodePoint.SECCHKCD) {
2118: // security check code.
2119: // included if and only if an error is detected when processing
2120: // the ACCSEC command. this has an implied severity code
2121: // of ERROR.
2122: foundInPass = true;
2123: secchkcdReceived = checkAndGetReceivedFlag(secchkcdReceived);
2124: secchkcd = parseSECCHKCD();
2125: peekCP = peekCodePoint();
2126: }
2127:
2128: if (!foundInPass) {
2129: doPrmnsprmSemantics(peekCP);
2130: }
2131: }
2132: popCollectionStack();
2133: checkRequiredObjects(secmecReceived);
2134:
2135: netConnection.setAccessSecurityData(secchkcd,
2136: securityMechanism, secmecList, sectknReceived, sectkn);
2137: }
2138:
2139: // Called by all the NET*Reply classes.
2140: void parseTYPDEFNAM() throws DisconnectException {
2141: parseLengthAndMatchCodePoint(CodePoint.TYPDEFNAM);
2142: netAgent_.targetTypdef_.setTypdefnam(readString());
2143: }
2144:
2145: // Called by all the NET*Reply classes.
2146: void parseTYPDEFOVR() throws DisconnectException {
2147: parseLengthAndMatchCodePoint(CodePoint.TYPDEFOVR);
2148: pushLengthOnCollectionStack();
2149: int peekCP = peekCodePoint();
2150:
2151: while (peekCP != Reply.END_OF_COLLECTION) {
2152:
2153: boolean foundInPass = false;
2154:
2155: if (peekCP == CodePoint.CCSIDSBC) {
2156: foundInPass = true;
2157: netAgent_.targetTypdef_.setCcsidSbc(parseCCSIDSBC());
2158: peekCP = peekCodePoint();
2159: }
2160:
2161: if (peekCP == CodePoint.CCSIDDBC) {
2162: foundInPass = true;
2163: netAgent_.targetTypdef_.setCcsidDbc(parseCCSIDDBC());
2164: peekCP = peekCodePoint();
2165: }
2166:
2167: if (peekCP == CodePoint.CCSIDMBC) {
2168: foundInPass = true;
2169: netAgent_.targetTypdef_.setCcsidMbc(parseCCSIDMBC());
2170: peekCP = peekCodePoint();
2171: }
2172:
2173: if (!foundInPass) {
2174: doPrmnsprmSemantics(peekCP);
2175: }
2176:
2177: }
2178: popCollectionStack();
2179: }
2180:
2181: // The SYNCCRD Reply Mesage
2182: //
2183: // Returned from Server:
2184: // XARETVAL - required
2185: int parseSYNCCRD(ConnectionCallbackInterface connection)
2186: throws DisconnectException {
2187: return 0;
2188: }
2189:
2190: // Process XA return value
2191: protected int parseXARETVAL() throws DisconnectException {
2192: return 0;
2193: }
2194:
2195: // Process XA return value
2196: protected byte parseSYNCTYPE() throws DisconnectException {
2197: return 0;
2198: }
2199:
2200: // This method handles the parsing of all command replies and reply data
2201: // for the SYNCCTL command.
2202: protected int parseSYNCCTLreply(
2203: ConnectionCallbackInterface connection)
2204: throws DisconnectException {
2205: return 0;
2206: }
2207:
2208: // Called by the XA commit and rollback parse reply methods.
2209: void parseSYNCCTLError(int peekCP) throws DisconnectException {
2210: switch (peekCP) {
2211: case CodePoint.CMDCHKRM:
2212: parseCMDCHKRM();
2213: break;
2214: case CodePoint.PRCCNVRM:
2215: parsePRCCNVRM();
2216: break;
2217: case CodePoint.SYNTAXRM:
2218: parseSYNTAXRM();
2219: break;
2220: case CodePoint.VALNSPRM:
2221: parseVALNSPRM();
2222: break;
2223: default:
2224: doObjnsprmSemantics(peekCP);
2225: }
2226: }
2227:
2228: // Manager-Level List.
2229: // Specifies a list of code points and support levels for the
2230: // classes of managers a server supports.
2231: // The target server must not provide information for any target
2232: // managers unless the source explicitly requests it.
2233: // For each manager class, if the target server's support level
2234: // is greater than or equal to the source server's level, then the source
2235: // server's level is returned for that class if the target server can operate
2236: // at the source's level; otherwise a level 0 is returned. If the target
2237: // server's support level is less than the source server's level, the
2238: // target server's level is returned for that class. If the target server
2239: // does not recognize the code point of a manager class or does not support
2240: // that class, it returns a level of 0. The target server then waits
2241: // for the next command or for the source server to terminate communications.
2242: // When the source server receives EXCSATRD, it must compare each of the entries
2243: // in the mgrlvlls parameter it received to the corresponding entries in the mgrlvlls
2244: // parameter it sent. If any level mismatches, the source server must decide
2245: // whether it can use or adjust to the lower level of target support for that manager
2246: // class. There are no architectural criteria for making this decision.
2247: // The source server can terminate communications or continue at the target
2248: // servers level of support. It can also attempt to use whatever
2249: // commands its user requests while receiving eror reply messages for real
2250: // functional mismatches.
2251: // The manager levels the source server specifies or the target server
2252: // returns must be compatible with the manager-level dependencies of the specified
2253: // manangers. Incompatible manager levels cannot be specified.
2254: // After this method successfully returns, the targetXXXX values (where XXXX
2255: // represents a manager name. example targetAgent) contain the negotiated
2256: // manager levels for this particular connection.
2257: private void parseMGRLVLLS(NetConnection netConnection)
2258: throws DisconnectException {
2259: parseLengthAndMatchCodePoint(CodePoint.MGRLVLLS);
2260:
2261: // each manager class and level is 4 bytes long.
2262: // get the length of the mgrlvls bytes, make sure it contains
2263: // the correct number of bytes for a mgrlvlls object, and calculate
2264: // the number of manager's returned from the server.
2265: int managerListLength = getDdmLength();
2266: if ((managerListLength == 0) || ((managerListLength % 4) != 0)) {
2267: doSyntaxrmSemantics(CodePoint.SYNERRCD_OBJ_LEN_NOT_ALLOWED);
2268: }
2269: int managerCount = managerListLength / 4;
2270:
2271: // the managerCount should be equal to the same number of
2272: // managers sent on the excsat.
2273:
2274: // read each of the manager levels returned from the server.
2275: for (int i = 0; i < managerCount; i++) {
2276:
2277: // first two byte are the manager's codepoint, next two bytes are the level.
2278: int managerCodePoint = parseCODPNTDR();
2279: int managerLevel = parseMGRLVLN();
2280:
2281: // check each manager to make sure levels are within proper limits
2282: // for this driver. Also make sure unexpected managers are not returned.
2283: switch (managerCodePoint) {
2284:
2285: case CodePoint.AGENT:
2286: if ((managerLevel < NetConfiguration.MIN_AGENT_MGRLVL)
2287: || (managerLevel > netConnection.targetAgent_)) {
2288: doMgrlvlrmSemantics(managerCodePoint, managerLevel);
2289: }
2290: netConnection.targetAgent_ = managerLevel;
2291: break;
2292:
2293: case CodePoint.CMNTCPIP:
2294: if ((managerLevel < NetConfiguration.MIN_CMNTCPIP_MGRLVL)
2295: || (managerLevel > netConnection.targetCmntcpip_)) {
2296: doMgrlvlrmSemantics(managerCodePoint, managerLevel);
2297: }
2298: netConnection.targetCmntcpip_ = managerLevel;
2299: break;
2300:
2301: case CodePoint.RDB:
2302: if ((managerLevel < NetConfiguration.MIN_RDB_MGRLVL)
2303: || (managerLevel > netConnection.targetRdb_)) {
2304: doMgrlvlrmSemantics(managerCodePoint, managerLevel);
2305: }
2306: netConnection.targetRdb_ = managerLevel;
2307: break;
2308:
2309: case CodePoint.SECMGR:
2310: if ((managerLevel < NetConfiguration.MIN_SECMGR_MGRLVL)
2311: || (managerLevel > netConnection.targetSecmgr_)) {
2312: doMgrlvlrmSemantics(managerCodePoint, managerLevel);
2313: }
2314: netConnection.targetSecmgr_ = managerLevel;
2315: break;
2316:
2317: case CodePoint.SQLAM:
2318: if ((managerLevel < NetConfiguration.MIN_SQLAM_MGRLVL)
2319: || (managerLevel > netAgent_.targetSqlam_)) {
2320: doMgrlvlrmSemantics(managerCodePoint, managerLevel);
2321: }
2322: netAgent_.orignalTargetSqlam_ = managerLevel;
2323: break;
2324:
2325: case CodePoint.CMNAPPC:
2326: if ((managerLevel < NetConfiguration.MIN_CMNAPPC_MGRLVL)
2327: || (managerLevel > netConnection.targetCmnappc_)) {
2328: doMgrlvlrmSemantics(managerCodePoint, managerLevel);
2329: }
2330: netConnection.targetCmnappc_ = managerLevel;
2331: break;
2332:
2333: case CodePoint.XAMGR:
2334: if ((managerLevel != 0)
2335: && (managerLevel < NetConfiguration.MIN_XAMGR_MGRLVL)
2336: || (managerLevel > netConnection.targetXamgr_)) {
2337: doMgrlvlrmSemantics(managerCodePoint, managerLevel);
2338: }
2339: netConnection.targetXamgr_ = managerLevel;
2340: break;
2341:
2342: case CodePoint.SYNCPTMGR:
2343: if ((managerLevel != 0)
2344: && (managerLevel < NetConfiguration.MIN_SYNCPTMGR_MGRLVL)
2345: || (managerLevel > netConnection.targetSyncptmgr_)) {
2346: doMgrlvlrmSemantics(managerCodePoint, managerLevel);
2347: }
2348: netConnection.targetSyncptmgr_ = managerLevel;
2349: break;
2350:
2351: case CodePoint.RSYNCMGR:
2352: if ((managerLevel != 0)
2353: && (managerLevel < NetConfiguration.MIN_RSYNCMGR_MGRLVL)
2354: || (managerLevel > netConnection.targetRsyncmgr_)) {
2355: doMgrlvlrmSemantics(managerCodePoint, managerLevel);
2356: }
2357: netConnection.targetRsyncmgr_ = managerLevel;
2358: break;
2359: // The target server must not provide information for any target managers
2360: // unless the source explicitly requests. The following managers are never requested.
2361: default:
2362: doMgrlvlrmSemantics(managerCodePoint, managerLevel);
2363: break;
2364: }
2365: }
2366: }
2367:
2368: // The External Name is the name of the job, task, or process on a
2369: // system for which a DDM server is active. On a source DDM server,
2370: // the external name is the name of the job that is requesting
2371: // access to remote resources. For a target DDM server,
2372: // the external name is the name of the job the system
2373: // creates or activates to run the DDM server.
2374: // No semantic meaning is assigned to external names in DDM.
2375: // External names are transmitted to aid in problem determination.
2376: protected String parseEXTNAM() throws DisconnectException {
2377: parseLengthAndMatchCodePoint(CodePoint.EXTNAM);
2378: return readString();
2379: }
2380:
2381: // Server Class name specifies the name of a class of DDM servers.
2382: // Server class names are assigned for each product involved in PROTOCOL.
2383: protected String parseSRVCLSNM() throws DisconnectException {
2384: parseLengthAndMatchCodePoint(CodePoint.SRVCLSNM);
2385: return readString();
2386: }
2387:
2388: // Server Name is the name of the DDM server.
2389: // No semantic meaning is assigned to server names in DDM,
2390: // but it is recommended that the server names are transmitted
2391: // for problem determination.
2392: protected String parseSRVNAM() throws DisconnectException {
2393: parseLengthAndMatchCodePoint(CodePoint.SRVNAM);
2394: return readString();
2395: }
2396:
2397: // Server Product Release Level String specifies the product
2398: // release level of a DDM server. The contents of the
2399: // parameter are unarchitected. Up to 255 bytes can be sent.
2400: // SRVRLSLV should not be used in place of product-defined
2401: // extensions to carry information not related to the products
2402: // release level.
2403: protected String parseSRVRLSLV() throws DisconnectException {
2404: parseLengthAndMatchCodePoint(CodePoint.SRVRLSLV);
2405: return readString();
2406: }
2407:
2408: // Manager-Level Number Attribute Binary Integer Number specifies
2409: // the level of a defined DDM manager.
2410: protected int parseMGRLVLN() throws DisconnectException {
2411: return readUnsignedShort();
2412: }
2413:
2414: // Security Mechanims.
2415: protected int[] parseSECMEC() throws DisconnectException {
2416: parseLengthAndMatchCodePoint(CodePoint.SECMEC);
2417: return readUnsignedShortList();
2418: }
2419:
2420: // The Security Token Byte String is information provided and used
2421: // by the various security mechanisms.
2422: protected byte[] parseSECTKN(boolean skip)
2423: throws DisconnectException {
2424: parseLengthAndMatchCodePoint(CodePoint.SECTKN);
2425: if (skip) {
2426: skipBytes();
2427: return null;
2428: }
2429: return readBytes();
2430: }
2431:
2432: // The Security Check Code String codifies the security information
2433: // and condition for the SECCHKRM.
2434: protected int parseSECCHKCD() throws DisconnectException {
2435: parseLengthAndMatchCodePoint(CodePoint.SECCHKCD);
2436: int secchkcd = readUnsignedByte();
2437: if ((secchkcd < CodePoint.SECCHKCD_00)
2438: || (secchkcd > CodePoint.SECCHKCD_15)) {
2439: doValnsprmSemantics(CodePoint.SECCHKCD, secchkcd);
2440: }
2441: return secchkcd;
2442: }
2443:
2444: // Product specific Identifier specifies the product release level
2445: // of a DDM server.
2446: protected String parsePRDID(boolean skip)
2447: throws DisconnectException {
2448: parseLengthAndMatchCodePoint(CodePoint.PRDID);
2449: if (skip) {
2450: skipBytes();
2451: return null;
2452: } else {
2453: return readString();
2454: }
2455: }
2456:
2457: // The User Id specifies an end-user name.
2458: protected String parseUSRID(boolean skip)
2459: throws DisconnectException {
2460: parseLengthAndMatchCodePoint(CodePoint.USRID);
2461: if (skip) {
2462: skipBytes();
2463: return null;
2464: }
2465: return readString();
2466: };
2467:
2468: // Code Point Data Representation specifies the data representation
2469: // of a dictionary codepoint. Code points are hexadecimal aliases for DDM
2470: // named terms.
2471: protected int parseCODPNTDR() throws DisconnectException {
2472: return readUnsignedShort();
2473: }
2474:
2475: // Correlation Token specifies a token that is conveyed between source
2476: // and target servers for correlating the processing between servers.
2477: protected byte[] parseCRRTKN(boolean skip)
2478: throws DisconnectException {
2479: parseLengthAndMatchCodePoint(CodePoint.CRRTKN);
2480: if (skip) {
2481: skipBytes();
2482: return null;
2483: }
2484: return readBytes();
2485: }
2486:
2487: // Unit of Work Disposition Scalar Object specifies the disposition of the
2488: // last unit of work.
2489: protected int parseUOWDSP() throws DisconnectException {
2490: parseLengthAndMatchCodePoint(CodePoint.UOWDSP);
2491: int uowdsp = readUnsignedByte();
2492: if ((uowdsp != CodePoint.UOWDSP_COMMIT)
2493: && (uowdsp != CodePoint.UOWDSP_ROLLBACK)) {
2494: doValnsprmSemantics(CodePoint.UOWDSP, uowdsp);
2495: }
2496: return uowdsp;
2497: }
2498:
2499: // Relational Database Name specifies the name of a relational
2500: // database of the server. A server can have more than one RDB.
2501: protected String parseRDBNAM(boolean skip)
2502: throws DisconnectException {
2503: parseLengthAndMatchCodePoint(CodePoint.RDBNAM);
2504: if (skip) {
2505: skipBytes();
2506: return null;
2507: }
2508: return readString();
2509: };
2510:
2511: protected int parseXIDCNT() throws DisconnectException {
2512: parseLengthAndMatchCodePoint(CodePoint.XIDCNT);
2513: return readUnsignedShort();
2514: }
2515:
2516: protected Xid parseXID() throws DisconnectException {
2517: return null;
2518: }
2519:
2520: protected java.util.Hashtable parseIndoubtList()
2521: throws DisconnectException {
2522: return null;
2523: }
2524:
2525: // Syntax Error Code String specifies the condition that caused termination
2526: // of data stream parsing.
2527: protected int parseSYNERRCD() throws DisconnectException {
2528: parseLengthAndMatchCodePoint(CodePoint.SYNERRCD);
2529: int synerrcd = readUnsignedByte();
2530: if ((synerrcd < 0x01) || (synerrcd > 0x1D)) {
2531: doValnsprmSemantics(CodePoint.SYNERRCD, synerrcd);
2532: }
2533: return synerrcd;
2534: }
2535:
2536: // The Code Point Data specifies a scalar value that is an architected code point.
2537: protected int parseCODPNT() throws DisconnectException {
2538: parseLengthAndMatchCodePoint(CodePoint.CODPNT);
2539: return parseCODPNTDR();
2540: }
2541:
2542: // Conversational Protocol Error Code specifies the condition
2543: // for which the PRCCNVRm was returned.
2544: protected int parsePRCCNVCD() throws DisconnectException {
2545: parseLengthAndMatchCodePoint(CodePoint.PRCCNVCD);
2546: int prccnvcd = readUnsignedByte();
2547: if ((prccnvcd != 0x01) && (prccnvcd != 0x02)
2548: && (prccnvcd != 0x03) && (prccnvcd != 0x04)
2549: && (prccnvcd != 0x05) && (prccnvcd != 0x06)
2550: && (prccnvcd != 0x10) && (prccnvcd != 0x11)
2551: && (prccnvcd != 0x12) && (prccnvcd != 0x13)
2552: && (prccnvcd != 0x15)) {
2553: doValnsprmSemantics(CodePoint.PRCCNVCD, prccnvcd);
2554: }
2555: return prccnvcd;
2556: }
2557:
2558: // CCSID for Single-Byte Characters specifies a coded character
2559: // set identifier for single-byte characters.
2560: protected int parseCCSIDSBC() throws DisconnectException {
2561: parseLengthAndMatchCodePoint(CodePoint.CCSIDSBC);
2562: return readUnsignedShort();
2563: }
2564:
2565: // CCSID for Mixed-Byte Characters specifies a coded character
2566: // set identifier for mixed-byte characters.
2567: protected int parseCCSIDMBC() throws DisconnectException {
2568: parseLengthAndMatchCodePoint(CodePoint.CCSIDMBC);
2569: return readUnsignedShort();
2570: }
2571:
2572: // CCSID for Double-Byte Characters specifies a coded character
2573: // set identifier for double-byte characters.
2574: protected int parseCCSIDDBC() throws DisconnectException {
2575: parseLengthAndMatchCodePoint(CodePoint.CCSIDDBC);
2576: return readUnsignedShort();
2577: }
2578:
2579: // Severity Code is an indicator of the severity of a condition
2580: // detected during the execution of a command.
2581: protected int parseSVRCOD(int minSvrcod, int maxSvrcod)
2582: throws DisconnectException {
2583: parseLengthAndMatchCodePoint(CodePoint.SVRCOD);
2584:
2585: int svrcod = readUnsignedShort();
2586: if ((svrcod != CodePoint.SVRCOD_INFO)
2587: && (svrcod != CodePoint.SVRCOD_WARNING)
2588: && (svrcod != CodePoint.SVRCOD_ERROR)
2589: && (svrcod != CodePoint.SVRCOD_SEVERE)
2590: && (svrcod != CodePoint.SVRCOD_ACCDMG)
2591: && (svrcod != CodePoint.SVRCOD_PRMDMG)
2592: && (svrcod != CodePoint.SVRCOD_SESDMG)) {
2593: doValnsprmSemantics(CodePoint.SVRCOD, svrcod);
2594: }
2595:
2596: if (svrcod < minSvrcod || svrcod > maxSvrcod) {
2597: doValnsprmSemantics(CodePoint.SVRCOD, svrcod);
2598: }
2599:
2600: return svrcod;
2601: }
2602:
2603: protected int parseFastSVRCOD(int minSvrcod, int maxSvrcod)
2604: throws DisconnectException {
2605: matchCodePoint(CodePoint.SVRCOD);
2606:
2607: int svrcod = readFastUnsignedShort();
2608: if ((svrcod != CodePoint.SVRCOD_INFO)
2609: && (svrcod != CodePoint.SVRCOD_WARNING)
2610: && (svrcod != CodePoint.SVRCOD_ERROR)
2611: && (svrcod != CodePoint.SVRCOD_SEVERE)
2612: && (svrcod != CodePoint.SVRCOD_ACCDMG)
2613: && (svrcod != CodePoint.SVRCOD_PRMDMG)
2614: && (svrcod != CodePoint.SVRCOD_SESDMG)) {
2615: doValnsprmSemantics(CodePoint.SVRCOD, svrcod);
2616: }
2617:
2618: if (svrcod < minSvrcod || svrcod > maxSvrcod) {
2619: doValnsprmSemantics(CodePoint.SVRCOD, svrcod);
2620: }
2621:
2622: return svrcod;
2623: }
2624:
2625: protected NetSqlca parseSQLCARD(Sqlca[] rowsetSqlca)
2626: throws DisconnectException {
2627: parseLengthAndMatchCodePoint(CodePoint.SQLCARD);
2628: int ddmLength = getDdmLength();
2629: ensureBLayerDataInBuffer(ddmLength);
2630: NetSqlca netSqlca = parseSQLCARDrow(rowsetSqlca);
2631: adjustLengths(getDdmLength());
2632: return netSqlca;
2633: }
2634:
2635: //--------------------------parse FDOCA objects------------------------
2636:
2637: // SQLCARD : FDOCA EARLY ROW
2638: // SQL Communications Area Row Description
2639: //
2640: // FORMAT FOR ALL SQLAM LEVELS
2641: // SQLCAGRP; GROUP LID 0x54; ELEMENT TAKEN 0(all); REP FACTOR 1
2642:
2643: NetSqlca parseSQLCARDrow(Sqlca[] rowsetSqlca)
2644: throws DisconnectException {
2645: return parseSQLCAGRP(rowsetSqlca);
2646: }
2647:
2648: // SQLNUMROW : FDOCA EARLY ROW
2649: // SQL Number of Elements Row Description
2650: //
2651: // FORMAT FOR SQLAM LEVELS
2652: // SQLNUMGRP; GROUP LID 0x58; ELEMENT TAKEN 0(all); REP FACTOR 1
2653: int parseSQLNUMROW() throws DisconnectException {
2654: return parseSQLNUMGRP();
2655: }
2656:
2657: int parseFastSQLNUMROW() throws DisconnectException {
2658: return parseFastSQLNUMGRP();
2659: }
2660:
2661: // SQLNUMGRP : FDOCA EARLY GROUP
2662: // SQL Number of Elements Group Description
2663: //
2664: // FORMAT FOR ALL SQLAM LEVELS
2665: // SQLNUM; PROTOCOL TYPE I2; ENVLID 0x04; Length Override 2
2666: private int parseSQLNUMGRP() throws DisconnectException {
2667: return readShort();
2668: }
2669:
2670: private int parseFastSQLNUMGRP() throws DisconnectException {
2671: return readFastShort();
2672: }
2673:
2674: // SQLCAGRP : FDOCA EARLY GROUP
2675: // SQL Communcations Area Group Description
2676: //
2677: // FORMAT FOR SQLAM <= 6
2678: // SQLCODE; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2679: // SQLSTATE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 5
2680: // SQLERRPROC; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 8
2681: // SQLCAXGRP; PROTOCOL TYPE N-GDA; ENVLID 0x52; Length Override 0
2682: //
2683: // FORMAT FOR SQLAM >= 7
2684: // SQLCODE; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2685: // SQLSTATE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 5
2686: // SQLERRPROC; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 8
2687: // SQLCAXGRP; PROTOCOL TYPE N-GDA; ENVLID 0x52; Length Override 0
2688: // SQLDIAGGRP; PROTOCOL TYPE N-GDA; ENVLID 0x56; Length Override 0
2689: private NetSqlca parseSQLCAGRP(Sqlca[] rowsetSqlca)
2690: throws DisconnectException {
2691: if (readFastUnsignedByte() == CodePoint.NULLDATA) {
2692: return null;
2693: }
2694:
2695: int sqlcode = readFastInt();
2696: byte[] sqlstate = readFastBytes(5);
2697: byte[] sqlerrproc = readFastBytes(8);
2698: NetSqlca netSqlca = null;
2699:
2700: try {
2701: netSqlca = new NetSqlca(netAgent_.netConnection_, sqlcode,
2702: sqlstate, sqlerrproc);
2703: } catch (SqlException sqle) {
2704: throw new DisconnectException(netAgent_, sqle);
2705: }
2706: parseSQLCAXGRP(netSqlca);
2707:
2708: if (netAgent_.targetSqlam_ >= NetConfiguration.MGRLVL_7) {
2709: netSqlca.setRowsetRowCount(parseSQLDIAGGRP(rowsetSqlca));
2710: }
2711:
2712: return netSqlca;
2713: }
2714:
2715: // SQLCAXGRP : EARLY FDOCA GROUP
2716: // SQL Communications Area Exceptions Group Description
2717: //
2718: // FORMAT FOR SQLAM <= 6
2719: // SQLRDBNME; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 18
2720: // SQLERRD1; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2721: // SQLERRD2; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2722: // SQLERRD3; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2723: // SQLERRD4; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2724: // SQLERRD5; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2725: // SQLERRD6; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2726: // SQLWARN0; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2727: // SQLWARN1; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2728: // SQLWARN2; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2729: // SQLWARN3; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2730: // SQLWARN4; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2731: // SQLWARN5; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2732: // SQLWARN6; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2733: // SQLWARN7; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2734: // SQLWARN8; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2735: // SQLWARN9; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2736: // SQLWARNA; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2737: // SQLERRMSG_m; PROTOCOL TYPE VCM; ENVLID 0x3E; Length Override 70
2738: // SQLERRMSG_s; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 70
2739: //
2740: // FORMAT FOR SQLAM >= 7
2741: // SQLERRD1; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2742: // SQLERRD2; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2743: // SQLERRD3; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2744: // SQLERRD4; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2745: // SQLERRD5; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2746: // SQLERRD6; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2747: // SQLWARN0; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2748: // SQLWARN1; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2749: // SQLWARN2; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2750: // SQLWARN3; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2751: // SQLWARN4; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2752: // SQLWARN5; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2753: // SQLWARN6; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2754: // SQLWARN7; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2755: // SQLWARN8; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2756: // SQLWARN9; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2757: // SQLWARNA; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2758: // SQLRDBNAME; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 255
2759: // SQLERRMSG_m; PROTOCOL TYPE VCM; ENVLID 0x3E; Length Override 70
2760: // SQLERRMSG_s; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 70
2761: private void parseSQLCAXGRP(NetSqlca netSqlca)
2762: throws DisconnectException {
2763: if (readFastUnsignedByte() == CodePoint.NULLDATA) {
2764: netSqlca.setContainsSqlcax(false);
2765: return;
2766: }
2767:
2768: if (netAgent_.targetSqlam_ < NetConfiguration.MGRLVL_7) {
2769: // skip over the rdbnam for now
2770: // SQLRDBNME; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 18
2771: skipFastBytes(18);
2772: }
2773: // SQLERRD1 to SQLERRD6; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
2774: int[] sqlerrd = new int[6];
2775: readFastIntArray(sqlerrd);
2776:
2777: // SQLWARN0 to SQLWARNA; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
2778: byte[] sqlwarn = readFastBytes(11);
2779:
2780: if (netAgent_.targetSqlam_ >= NetConfiguration.MGRLVL_7) {
2781: // skip over the rdbnam for now
2782: // SQLRDBNAME; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 255
2783: parseFastVCS();
2784: }
2785:
2786: int sqlerrmcCcsid = 0;
2787: byte[] sqlerrmc = readFastLDBytes();
2788: if (sqlerrmc != null) {
2789: sqlerrmcCcsid = netAgent_.targetTypdef_.getCcsidMbc();
2790: skipFastBytes(2);
2791: } else {
2792: sqlerrmc = readFastLDBytes();
2793: sqlerrmcCcsid = netAgent_.targetTypdef_.getCcsidSbc();
2794: }
2795:
2796: netSqlca.setSqlerrd(sqlerrd);
2797: netSqlca.setSqlwarnBytes(sqlwarn);
2798: netSqlca.setSqlerrmcBytes(sqlerrmc, sqlerrmcCcsid); // sqlerrmc may be null
2799: }
2800:
2801: // SQLDIAGGRP : FDOCA EARLY GROUP
2802: // SQL Diagnostics Group Description - Identity 0xD1
2803: // Nullable Group
2804: // SQLDIAGSTT; PROTOCOL TYPE N-GDA; ENVLID 0xD3; Length Override 0
2805: // SQLDIAGCN; DRFA TYPE N-RLO; ENVLID 0xF6; Length Override 0
2806: // SQLDIAGCI; PROTOCOL TYPE N-RLO; ENVLID 0xF5; Length Override 0
2807: private long parseSQLDIAGGRP(Sqlca[] rowsetSqlca)
2808: throws DisconnectException {
2809: if (readFastUnsignedByte() == CodePoint.NULLDATA) {
2810: return 0;
2811: }
2812:
2813: long row_count = parseSQLDIAGSTT(rowsetSqlca);
2814: parseSQLDIAGCI(rowsetSqlca);
2815: parseSQLDIAGCN();
2816:
2817: return row_count;
2818: }
2819:
2820: // this is duplicated in parseColumnMetaData, but different
2821: // DAGroup under NETColumnMetaData requires a lot more stuffs including
2822: // precsion, scale and other stuffs
2823: protected String parseFastVCS() throws DisconnectException {
2824: // doublecheck what readString() does if the length is 0
2825: return readFastString(readFastUnsignedShort(),
2826: netAgent_.targetTypdef_.getCcsidSbcEncoding());
2827: }
2828:
2829: //----------------------non-parsing computational helper methods--------------
2830:
2831: protected boolean checkAndGetReceivedFlag(boolean receivedFlag)
2832: throws DisconnectException {
2833: if (receivedFlag) {
2834: // this method will throw a disconnect exception if
2835: // the received flag is already true;
2836: doSyntaxrmSemantics(CodePoint.SYNERRCD_DUP_OBJ_PRESENT);
2837: }
2838: return true;
2839: }
2840:
2841: protected void checkRequiredObjects(boolean receivedFlag)
2842: throws DisconnectException {
2843: if (!receivedFlag) {
2844: doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND);
2845: }
2846: }
2847:
2848: protected void checkRequiredObjects(boolean receivedFlag,
2849: boolean receivedFlag2) throws DisconnectException {
2850: if (!receivedFlag || !receivedFlag2) {
2851: doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND);
2852: }
2853: }
2854:
2855: protected void checkRequiredObjects(boolean receivedFlag,
2856: boolean receivedFlag2, boolean receivedFlag3)
2857: throws DisconnectException {
2858: if (!receivedFlag || !receivedFlag2 || !receivedFlag3) {
2859: doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND);
2860: }
2861: }
2862:
2863: protected void checkRequiredObjects(boolean receivedFlag,
2864: boolean receivedFlag2, boolean receivedFlag3,
2865: boolean receivedFlag4) throws DisconnectException {
2866: if (!receivedFlag || !receivedFlag2 || !receivedFlag3
2867: || !receivedFlag4) {
2868: doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND);
2869: }
2870: }
2871:
2872: protected void checkRequiredObjects(boolean receivedFlag,
2873: boolean receivedFlag2, boolean receivedFlag3,
2874: boolean receivedFlag4, boolean receivedFlag5,
2875: boolean receivedFlag6) throws DisconnectException {
2876: if (!receivedFlag || !receivedFlag2 || !receivedFlag3
2877: || !receivedFlag4 || !receivedFlag5 || !receivedFlag6) {
2878: doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND);
2879: }
2880:
2881: }
2882:
2883: protected void checkRequiredObjects(boolean receivedFlag,
2884: boolean receivedFlag2, boolean receivedFlag3,
2885: boolean receivedFlag4, boolean receivedFlag5,
2886: boolean receivedFlag6, boolean receivedFlag7)
2887: throws DisconnectException {
2888: if (!receivedFlag || !receivedFlag2 || !receivedFlag3
2889: || !receivedFlag4 || !receivedFlag5 || !receivedFlag6
2890: || !receivedFlag7) {
2891: doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND);
2892: }
2893: }
2894:
2895: // These methods are "private protected", which is not a recognized java privilege,
2896: // but means that these methods are private to this class and to subclasses,
2897: // and should not be used as package-wide friendly methods.
2898:
2899: protected void doObjnsprmSemantics(int codePoint)
2900: throws DisconnectException {
2901: agent_
2902: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
2903: agent_,
2904: new ClientMessageId(
2905: SQLState.DRDA_DDM_OBJECT_NOT_SUPPORTED),
2906: Integer.toHexString(codePoint)));
2907: }
2908:
2909: // Also called by NetStatementReply.
2910: protected void doPrmnsprmSemantics(int codePoint)
2911: throws DisconnectException {
2912: agent_
2913: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
2914: agent_, new ClientMessageId(
2915: SQLState.DRDA_DDM_PARAM_NOT_SUPPORTED),
2916: Integer.toHexString(codePoint)));
2917: }
2918:
2919: // Also called by NetStatementReply
2920: void doValnsprmSemantics(int codePoint, int value)
2921: throws DisconnectException {
2922: doValnsprmSemantics(codePoint, Integer.toString(value));
2923: }
2924:
2925: void doValnsprmSemantics(int codePoint, String value)
2926: throws DisconnectException {
2927:
2928: // special case the FDODTA codepoint not to disconnect.
2929: if (codePoint == CodePoint.FDODTA) {
2930: agent_.accumulateReadException(new SqlException(
2931: agent_.logWriter_, new ClientMessageId(
2932: SQLState.DRDA_DDM_PARAMVAL_NOT_SUPPORTED),
2933: Integer.toHexString(codePoint)));
2934: return;
2935: }
2936:
2937: if (codePoint == CodePoint.CCSIDSBC
2938: || codePoint == CodePoint.CCSIDDBC
2939: || codePoint == CodePoint.CCSIDMBC) {
2940: // the server didn't like one of the ccsids.
2941: // the message should reflect the error in question. right now these values
2942: // will be hard coded but this won't be correct if our driver starts sending
2943: // other values to the server. In order to pick up the correct values,
2944: // a little reorganization may need to take place so that this code (or
2945: // whatever code sets the message) has access to the correct values.
2946: int cpValue = 0;
2947: switch (codePoint) {
2948: case CodePoint.CCSIDSBC:
2949: cpValue = netAgent_.typdef_.getCcsidSbc();
2950: break;
2951: case CodePoint.CCSIDDBC:
2952: cpValue = netAgent_.typdef_.getCcsidDbc();
2953: break;
2954: case CodePoint.CCSIDMBC:
2955: cpValue = netAgent_.typdef_.getCcsidSbc();
2956: break;
2957: default:
2958: // should never be in this default case...
2959: cpValue = 0;
2960: break;
2961: }
2962: agent_
2963: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
2964: agent_,
2965: new ClientMessageId(
2966: SQLState.DRDA_NO_AVAIL_CODEPAGE_CONVERSION),
2967: new Integer(cpValue), value));
2968: return;
2969: }
2970: // the problem isn't with one of the ccsid values so...
2971:
2972: // Returning more information would
2973: // require rearranging this code a little.
2974: agent_
2975: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
2976: agent_,
2977: new ClientMessageId(
2978: SQLState.DRDA_DDM_PARAMVAL_NOT_SUPPORTED),
2979: Integer.toHexString(codePoint)));
2980: }
2981:
2982: void doDtamchrmSemantics() throws DisconnectException {
2983: agent_
2984: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
2985: agent_,
2986: new ClientMessageId(
2987: SQLState.DRDA_CONNECTION_TERMINATED),
2988: msgutil_
2989: .getTextMessage(MessageId.CONN_DRDA_DTARMCHRM)));
2990: }
2991:
2992: // Messages
2993: // SQLSTATE : 58010
2994: // Execution failed due to a distribution protocol error that
2995: // will affect the successful execution of subsequent DDM commands
2996: // or SQL statements.
2997: // SQLCODE : -30021
2998: // Execution failed because of a Distributed Protocol
2999: // Error that will affect the successful execution of subsequent
3000: // commands and SQL statements: Manager <manager> at Level
3001: // <level> not supported.
3002: //
3003: // A system erro occurred that prevented successful connection
3004: // of the application to the remote database. This message (SQLCODE)
3005: // is producted for SQL CONNECT statement.
3006: private void doMgrlvlrmSemantics(String manager, String level)
3007: throws DisconnectException {
3008: agent_
3009: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
3010: agent_, new ClientMessageId(
3011: SQLState.DRDA_MGRLVLRM), manager, level));
3012: }
3013:
3014: private void doMgrlvlrmSemantics(int manager, int level)
3015: throws DisconnectException {
3016: doMgrlvlrmSemantics("0x" + Integer.toHexString(manager), "0x"
3017: + Integer.toHexString(level));
3018: }
3019:
3020: private void doMgrlvlrmSemantics(int[] nameList, int[] levelList)
3021: throws DisconnectException {
3022: StringBuffer managerNames = new StringBuffer(100);
3023: StringBuffer managerLevels = new StringBuffer(100);
3024:
3025: int count = nameList.length;
3026: for (int i = 0; i < count; i++) {
3027: managerNames.append("0x");
3028: managerNames.append(nameList[i]);
3029: managerLevels.append("0x");
3030: managerLevels.append(levelList[i]);
3031: if (i != (count - 1)) {
3032: managerNames.append(",");
3033: managerLevels.append(",");
3034: }
3035: }
3036: doMgrlvlrmSemantics(managerNames.toString(), managerLevels
3037: .toString());
3038: }
3039:
3040: // The client can detect that a conversational protocol error has occurred.
3041: // This can also be detected at the server in which case a PRCCNVRM is returned.
3042: // The Conversation Protocol Error Code, PRCCNVRM, describes the various errors.
3043: //
3044: // Note: Not all of these may be valid at the client. See descriptions for
3045: // which ones make sense for client side errors/checks.
3046: // Conversation Error Code Description of Error
3047: // ----------------------- --------------------
3048: // 0x01 RPYDSS received by target communications manager.
3049: // 0x02 Multiple DSSs sent without chaining or multiple
3050: // DSS chains sent.
3051: // 0x03 OBJDSS sent when not allowed.
3052: // 0x04 Request correlation identifier of an RQSDSS
3053: // is less than or equal to the previous
3054: // RQSDSS's request correlatio identifier in the chain.
3055: // 0x05 Request correlation identifier of an OBJDSS
3056: // does not equal the request correlation identifier
3057: // of the preceding RQSDSS.
3058: // 0x06 EXCSAT was not the first command after the connection
3059: // was established.
3060: // 0x10 ACCSEC or SECCHK command sent in wrong state.
3061: // 0x11 SYNCCTL or SYNCRSY command is used incorrectly.
3062: // 0x12 RDBNAM mismatch between ACCSEC, SECCHK, and ACCRDB.
3063: // 0x13 A command follows one that returned EXTDTAs as reply object.
3064: //
3065: // When the client detects these errors, it will be handled as if a PRCCNVRM is returned
3066: // from the server. In this PRCCNVRM case, PROTOCOL architects an SQLSTATE of 58008 or 58009
3067: // depening of the SVRCOD. In this case, a 58009 will always be returned.
3068: // Messages
3069: // SQLSTATE : 58009
3070: // Execution failed due to a distribution protocol error that caused deallocation of the conversation.
3071: // SQLCODE : -30020
3072: // Execution failed because of a Distributed Protocol
3073: // Error that will affect the successful execution of subsequent
3074: // commands and SQL statements: Reason Code <reason-code>.
3075: // Some possible reason codes include:
3076: // 121C Indicates that the user is not authorized to perform the requested command.
3077: // 1232 The command could not be completed because of a permanent error.
3078: // In most cases, the server will be in the process of an abend.
3079: // 220A The target server has received an invalid data description.
3080: // If a user SQLDA is specified, ensure that the fields are
3081: // initialized correctly. Also, ensure that the length does not
3082: // exceed the maximum allowed length for the data type being used.
3083: //
3084: // The command or statement cannot be processed. The current
3085: // transaction is rolled back and the application is disconnected
3086: // from the remote database.
3087: protected void doPrccnvrmSemantics(int conversationProtocolErrorCode)
3088: throws DisconnectException {
3089: // we may need to map the conversation protocol error code, prccnvcd, to some kind
3090: // of reason code. For now just return the prccnvcd as the reason code
3091: agent_
3092: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
3093: agent_,
3094: new ClientMessageId(
3095: SQLState.DRDA_CONNECTION_TERMINATED),
3096: msgutil_
3097: .getTextMessage(
3098: MessageId.CONN_DRDA_PRCCNVRM,
3099: Integer
3100: .toHexString(conversationProtocolErrorCode))));
3101: }
3102:
3103: // SQL Diagnostics Condition Token Array - Identity 0xF7
3104: // SQLNUMROW; ROW LID 0x68; ELEMENT TAKEN 0(all); REP FACTOR 1
3105: // SQLTOKROW; ROW LID 0xE7; ELEMENT TAKEN 0(all); REP FACTOR 0(all)
3106: void parseSQLDCTOKS() throws DisconnectException {
3107: if (readFastUnsignedByte() == CodePoint.NULLDATA) {
3108: return;
3109: }
3110: int num = parseFastSQLNUMROW();
3111: for (int i = 0; i < num; i++) {
3112: parseSQLTOKROW();
3113: }
3114: }
3115:
3116: // SQL Diagnostics Condition Information Array - Identity 0xF5
3117: // SQLNUMROW; ROW LID 0x68; ELEMENT TAKEN 0(all); REP FACTOR 1
3118: // SQLDCIROW; ROW LID 0xE5; ELEMENT TAKEN 0(all); REP FACTOR 0(all)
3119: private void parseSQLDIAGCI(Sqlca[] rowsetSqlca)
3120: throws DisconnectException {
3121: if (readFastUnsignedByte() == CodePoint.NULLDATA) {
3122: return;
3123: }
3124: int num = parseFastSQLNUMROW();
3125: if (num == 0) {
3126: resetRowsetSqlca(rowsetSqlca, 0);
3127: }
3128:
3129: // lastRow is the row number for the last row that had a non-null SQLCA.
3130: int lastRow = 1;
3131: for (int i = 0; i < num; i++) {
3132: lastRow = parseSQLDCROW(rowsetSqlca, lastRow);
3133: }
3134: resetRowsetSqlca(rowsetSqlca, lastRow + 1);
3135: }
3136:
3137: // SQL Diagnostics Connection Array - Identity 0xF6
3138: // SQLNUMROW; ROW LID 0x68; ELEMENT TAKEN 0(all); REP FACTOR 1
3139: // SQLCNROW; ROW LID 0xE6; ELEMENT TAKEN 0(all); REP FACTOR 0(all)
3140: private void parseSQLDIAGCN() throws DisconnectException {
3141: if (readUnsignedByte() == CodePoint.NULLDATA) {
3142: return;
3143: }
3144: int num = parseFastSQLNUMROW();
3145: for (int i = 0; i < num; i++) {
3146: parseSQLCNROW();
3147: }
3148: }
3149:
3150: // SQL Diagnostics Connection Row - Identity 0xE6
3151: // SQLCNGRP; GROUP LID 0xD6; ELEMENT TAKEN 0(all); REP FACTOR 1
3152: private void parseSQLCNROW() throws DisconnectException {
3153: parseSQLCNGRP();
3154: }
3155:
3156: // SQL Diagnostics Condition Row - Identity 0xE5
3157: // SQLDCGRP; GROUP LID 0xD5; ELEMENT TAKEN 0(all); REP FACTOR 1
3158: private int parseSQLDCROW(Sqlca[] rowsetSqlca, int lastRow)
3159: throws DisconnectException {
3160: return parseSQLDCGRP(rowsetSqlca, lastRow);
3161: }
3162:
3163: // SQL Diagnostics Token Row - Identity 0xE7
3164: // SQLTOKGRP; GROUP LID 0xD7; ELEMENT TAKEN 0(all); REP FACTOR 1
3165: private void parseSQLTOKROW() throws DisconnectException {
3166: parseSQLTOKGRP();
3167: }
3168:
3169: // check on SQLTOKGRP format
3170: private void parseSQLTOKGRP() throws DisconnectException {
3171: skipFastNVCMorNVCS();
3172: }
3173:
3174: // SQL Diagnostics Statement Group Description - Identity 0xD3
3175: // Nullable Group
3176: // SQLDSFCOD; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3177: // SQLDSCOST; PROTOCOL TYPE I4; ENVLID 0X02; Length Override 4
3178: // SQLDSLROW; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3179: // SQLDSNPM; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3180: // SQLDSNRS; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3181: // SQLDSRNS; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3182: // SQLDSDCOD; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3183: // SQLDSROWC; PROTOCOL TYPE FD; ENVLID 0x0E; Length Override 31
3184: // SQLDSNROW; PROTOCOL TYPE FD; ENVLID 0x0E; Length Override 31
3185: // SQLDSROWCS; PROTOCOL TYPE FD; ENVLID 0x0E; Length Override 31
3186: // SQLDSACON; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
3187: // SQLDSACRH; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
3188: // SQLDSACRS; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
3189: // SQLDSACSL; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
3190: // SQLDSACSE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
3191: // SQLDSACTY; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
3192: // SQLDSCERR; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
3193: // SQLDSMORE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
3194: private long parseSQLDIAGSTT(Sqlca[] rowsetSqlca)
3195: throws DisconnectException {
3196: if (readFastUnsignedByte() == CodePoint.NULLDATA) {
3197: return 0;
3198: }
3199: int sqldsFcod = readFastInt(); // FUNCTION_CODE
3200: int sqldsCost = readFastInt(); // COST_ESTIMATE
3201: int sqldsLrow = readFastInt(); // LAST_ROW
3202:
3203: skipFastBytes(16);
3204:
3205: long sqldsRowc = readFastLong(); // ROW_COUNT
3206:
3207: skipFastBytes(24);
3208:
3209: return sqldsRowc;
3210: }
3211:
3212: // SQL Diagnostics Connection Group Description - Identity 0xD6
3213: // Nullable
3214: //
3215: // SQLCNSTATE; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3216: // SQLCNSTATUS; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3217: // SQLCNATYPE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
3218: // SQLCNETYPE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1
3219: // SQLCNPRDID; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 8
3220: // SQLCNRDB; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 255
3221: // SQLCNCLASS; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 255
3222: // SQLCNAUTHID; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 255
3223: private void parseSQLCNGRP() throws DisconnectException {
3224: skipBytes(18);
3225: String sqlcnRDB = parseFastVCS(); // RDBNAM
3226: String sqlcnClass = parseFastVCS(); // CLASS_NAME
3227: String sqlcnAuthid = parseFastVCS(); // AUTHID
3228: }
3229:
3230: // SQL Diagnostics Condition Group Description
3231: //
3232: // SQLDCCODE; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3233: // SQLDCSTATE; PROTOCOL TYPE FCS; ENVLID Ox30; Lengeh Override 5
3234: // SQLDCREASON; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3235: // SQLDCLINEN; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3236: // SQLDCROWN; PROTOCOL TYPE FD; ENVLID 0x0E; Lengeh Override 31
3237: // SQLDCER01; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3238: // SQLDCER02; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3239: // SQLDCER03; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3240: // SQLDCER04; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3241: // SQLDCPART; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3242: // SQLDCPPOP; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4
3243: // SQLDCMSGID; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 10
3244: // SQLDCMDE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 8
3245: // SQLDCPMOD; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 5
3246: // SQLDCRDB; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 255
3247: // SQLDCTOKS; PROTOCOL TYPE N-RLO; ENVLID 0xF7; Length Override 0
3248: // SQLDCMSG_m; PROTOCOL TYPE NVMC; ENVLID 0x3F; Length Override 32672
3249: // SQLDCMSG_S; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 32672
3250: // SQLDCCOLN_m; PROTOCOL TYPE NVCM ; ENVLID 0x3F; Length Override 255
3251: // SQLDCCOLN_s; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3252: // SQLDCCURN_m; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3253: // SQLDCCURN_s; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3254: // SQLDCPNAM_m; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3255: // SQLDCPNAM_s; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3256: // SQLDCXGRP; PROTOCOL TYPE N-GDA; ENVLID 0xD3; Length Override 1
3257: private int parseSQLDCGRP(Sqlca[] rowsetSqlca, int lastRow)
3258: throws DisconnectException {
3259: int sqldcCode = readFastInt(); // SQLCODE
3260: String sqldcState = readFastString(5, Typdef.UTF8ENCODING); // SQLSTATE
3261: int sqldcReason = readFastInt(); // REASON_CODE
3262: int sqldcLinen = readFastInt(); // LINE_NUMBER
3263: int sqldcRown = (int) readFastLong(); // ROW_NUMBER
3264:
3265: // save +20237 in the 0th entry of the rowsetSqlca's.
3266: // this info is going to be used when a subsequent fetch prior is issued, and if already
3267: // received a +20237 then we've gone beyond the first row and there is no need to
3268: // flow another fetch to the server.
3269: if (sqldcCode == 20237) {
3270: rowsetSqlca[0] = new NetSqlca(netAgent_.netConnection_,
3271: sqldcCode, sqldcState, null);
3272: } else {
3273: if (rowsetSqlca[sqldcRown] != null) {
3274: rowsetSqlca[sqldcRown].resetRowsetSqlca(
3275: netAgent_.netConnection_, sqldcCode,
3276: sqldcState, null);
3277: } else {
3278: rowsetSqlca[sqldcRown] = new NetSqlca(
3279: netAgent_.netConnection_, sqldcCode,
3280: sqldcState, null);
3281: }
3282: }
3283:
3284: // reset all entries between lastRow and sqldcRown to null
3285: for (int i = lastRow + 1; i < sqldcRown; i++) {
3286: rowsetSqlca[i] = null;
3287: }
3288:
3289: skipFastBytes(47);
3290: String sqldcRdb = parseFastVCS(); // RDBNAM
3291: // skip the tokens for now, since we already have the complete message.
3292: parseSQLDCTOKS(); // MESSAGE_TOKENS
3293: String sqldcMsg = parseFastNVCMorNVCS(); // MESSAGE_TEXT
3294:
3295: // skip the following for now.
3296: skipFastNVCMorNVCS(); // COLUMN_NAME
3297: skipFastNVCMorNVCS(); // PARAMETER_NAME
3298: skipFastNVCMorNVCS(); // EXTENDED_NAMES
3299:
3300: parseSQLDCXGRP(); // SQLDCXGRP
3301: return sqldcRown;
3302: }
3303:
3304: // SQL Diagnostics Extended Names Group Description - Identity 0xD5
3305: // Nullable
3306: //
3307: // SQLDCXRDB_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3308: // SQLDCXSCH_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3309: // SQLDCXNAM_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3310: // SQLDCXTBLN_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3311: // SQLDCXRDB_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3312: // SQLDCXSCH_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3313: // SQLDCXNAM_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3314: // SQLDCXTBLN_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3315: //
3316: // SQLDCXCRDB_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3317: // SQLDCXCSCH_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3318: // SQLDCXCNAM_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3319: // SQLDCXCRDB_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3320: // SQLDCXCSCH_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3321: // SQLDCXCNAM_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3322: //
3323: // SQLDCXRRDB_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3324: // SQLDCXRSCH_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3325: // SQLDCXRNAM_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3326: // SQLDCXRRDB_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3327: // SQLDCXRSCH_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3328: // SQLDCXRNAM_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3329: //
3330: // SQLDCXTRDB_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3331: // SQLDCXTSCH_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3332: // SQLDCXTNAM_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255
3333: // SQLDCXTRDB_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3334: // SQLDCXTSCH_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3335: // SQLDCXTNAM_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255
3336: private void parseSQLDCXGRP() throws DisconnectException {
3337: if (readFastUnsignedByte() == CodePoint.NULLDATA) {
3338: return;
3339: }
3340: skipFastNVCMorNVCS(); // OBJECT_RDBNAM
3341: skipFastNVCMorNVCS(); // OBJECT_SCHEMA
3342: skipFastNVCMorNVCS(); // SPECIFIC_NAME
3343: skipFastNVCMorNVCS(); // TABLE_NAME
3344: String sqldcxCrdb = parseFastVCS(); // CONSTRAINT_RDBNAM
3345: skipFastNVCMorNVCS(); // CONSTRAINT_SCHEMA
3346: skipFastNVCMorNVCS(); // CONSTRAINT_NAME
3347: parseFastVCS(); // ROUTINE_RDBNAM
3348: skipFastNVCMorNVCS(); // ROUTINE_SCHEMA
3349: skipFastNVCMorNVCS(); // ROUTINE_NAME
3350: parseFastVCS(); // TRIGGER_RDBNAM
3351: skipFastNVCMorNVCS(); // TRIGGER_SCHEMA
3352: skipFastNVCMorNVCS(); // TRIGGER_NAME
3353: }
3354:
3355: private String parseFastNVCMorNVCS() throws DisconnectException {
3356: String stringToBeSet = null;
3357: int vcm_length = 0;
3358: int vcs_length = 0;
3359: if (readFastUnsignedByte() != CodePoint.NULLDATA) {
3360: vcm_length = readFastUnsignedShort();
3361: if (vcm_length > 0) {
3362: stringToBeSet = readFastString(vcm_length,
3363: netAgent_.targetTypdef_.getCcsidMbcEncoding());
3364: }
3365: if (readFastUnsignedByte() != CodePoint.NULLDATA) {
3366: agent_
3367: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
3368: agent_,
3369: new ClientMessageId(
3370: SQLState.NET_NVCM_NVCS_BOTH_NON_NULL)));
3371: }
3372: } else {
3373: if (readFastUnsignedByte() != CodePoint.NULLDATA) {
3374: vcs_length = readFastUnsignedShort();
3375: if (vcs_length > 0) {
3376: stringToBeSet = readFastString(vcs_length,
3377: netAgent_.targetTypdef_
3378: .getCcsidSbcEncoding());
3379: }
3380: }
3381: }
3382: return stringToBeSet;
3383: }
3384:
3385: private void skipFastNVCMorNVCS() throws DisconnectException {
3386: int vcm_length = 0;
3387: int vcs_length = 0;
3388: if (readFastUnsignedByte() != CodePoint.NULLDATA) {
3389: vcm_length = readFastUnsignedShort();
3390: if (vcm_length > 0)
3391: //stringToBeSet = readString (vcm_length, netAgent_.targetTypdef_.getCcsidMbcEncoding());
3392: {
3393: skipFastBytes(vcm_length);
3394: }
3395: if (readFastUnsignedByte() != CodePoint.NULLDATA) {
3396: agent_
3397: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
3398: agent_,
3399: new ClientMessageId(
3400: SQLState.NET_NVCM_NVCS_BOTH_NON_NULL)));
3401: }
3402: } else {
3403: if (readFastUnsignedByte() != CodePoint.NULLDATA) {
3404: vcs_length = readFastUnsignedShort();
3405: if (vcs_length > 0)
3406: //stringToBeSet = readString (vcs_length, netAgent_.targetTypdef_.getCcsidSbcEncoding());
3407: {
3408: skipFastBytes(vcs_length);
3409: }
3410: }
3411: }
3412: }
3413:
3414: void resetRowsetSqlca(Sqlca[] rowsetSqlca, int row) {
3415: // rowsetSqlca can be null.
3416: int count = ((rowsetSqlca == null) ? 0 : rowsetSqlca.length);
3417: for (int i = row; i < count; i++) {
3418: rowsetSqlca[i] = null;
3419: }
3420: }
3421: }
|