BizTalk Adapter for DB2 and the SQLCAMESSAGE DB2 Procedure
QUESTION:
When there is a failure calling a Stored Procedure using the BizTalk Adapter for DB2, you may see that some other SP´s are also called. You can also see that there is no relationship between this extra calls and the one that fails.
A trace can look similar to this:
Preparing Stored Procedure in SP section: SYSIBM.SQLPROCEDURECOLS, 337, 553, 2, DRDAProcedureColumns, sqlcallcontrol.cpp,
Executing Stored Procedure: SYSIBM.SQLPROCEDURECOLS, 337, 553, 9, DRDAProcedureColumns, sqlcallcontrol.cpp,
DRDA AR message: Name: SQLCA Message, SQLSTATE: 42724, SQLCODE: -444, Error Procedure: DSNX9CAC, Database: DBT1LOC, Errors: {0, 0, 0, -1, 0, 0}, Diagnostic Information: DSNAPCO8?, 337, 553, 4, DRDAProcedureColumns, messagesync.h,
Preparing Stored Procedure in SP section: SYSIBM.SQLCAMESSAGE, 337, 553, 2, DRDAGetDiagRec, sqlcallcontrol.cpp,
Executing Stored Procedure: SYSIBM.SQLCAMESSAGE, 337, 553, 9, DRDAGetDiagRec, sqlcallcontrol.cpp,
DRDA AR message: Name: ENDUOWRM, Severity: Warning, Database: DBT1LOC, 337, 553, 4, DRDAGetDiagRec, messagesync.h,
Preparing SQL Select Statement: SELECT '' AS PROCEDURE_CAT, RTRIM(OWNER) AS PROCEDURE_SCHEM, RTRIM(NAME) AS PROCEDURE_NAME, RTRIM(PARMNAME) AS COLUMN_NAME, ORDINAL AS ORDINAL_POSITION, RTRIM(ROWTYPE) AS COLUMN_TYPE, RTRIM(TYPENAME) AS TYPE_NAME, LENGTH AS COLUMN_SIZE, LENGTH AS, 337, 553, 4, DRDAExecDirectW, sqlselectcontrol.cpp,
Executing SQL Select Statement: SELECT '' AS PROCEDURE_CAT, RTRIM(OWNER) AS PROCEDURE_SCHEM, RTRIM(NAME) AS PROCEDURE_NAME, RTRIM(PARMNAME) AS COLUMN_NAME, ORDINAL AS ORDINAL_POSITION, RTRIM(ROWTYPE) AS COLUMN_TYPE, RTRIM(TYPENAME) AS TYPE_NAME, LENGTH AS COLUMN_SIZE, LENGTH AS, 337, 553, 8, DRDAExecDirectW, sqlselectcontrol.cpp,
Closing SQL Select Statement: SELECT '' AS PROCEDURE_CAT, RTRIM(OWNER) AS PROCEDURE_SCHEM, RTRIM(NAME) AS PROCEDURE_NAME, RTRIM(PARMNAME) AS COLUMN_NAME, ORDINAL AS ORDINAL_POSITION, RTRIM(ROWTYPE) AS COLUMN_TYPE, RTRIM(TYPENAME) AS TYPE_NAME, LENGTH AS COLUMN_SIZE, LENGTH AS PREC, 337, 553, 16, DRDAFreeStmt, sqlselectcontrol.cpp,
Local Transaction Commit, 337, 553, 3, DRDAFreeStmt, transactioncontext.cpp,
ANSWER:
The call to SQLPROCEDURECOLS is executed in order to gather metadata (parameter information) from the stored procedure to be executed. If an error occurs or this system procedure is not available, we fall back to query the metadata using SELECT statements gainst the system catalog (see the three ocurrences of SELECT '' AS PROCEDURE_CAT…). The SQLCAMESSAGE is a stored procedure that we call when a error occur so we can gather extra information about the error that occurred. With that said, the calls for the procedures SQLPROCEDURECOLS and SQLCAMESSAGE are expected and, in this case, don’t tell much about the error occuring on the original procedure that was going to be called.