NonStop JMS C++ API Programmer's Guide
NonStop Server for Java Message Service C++ API Programmer’s Guide—526459-002
8-1
8 Troubleshooting
Recovering from SQL/MX Exceptions
The SQL/MX exception condition messages listed below are retryable within the
context of the NSJMS C++ API as shown in Recovering within Producer::send()
Operations on page 8-1 and Recovering within Consumer::receive() Operations on
page 8-2.
SQL -8102
Cause. You attempted to perform an operation that is prevented by a unique
constraint. This is sometimes referred to as a duplicate key error.
Effect. SQL/MX could not perform the operation.
Recovery. Make the data you enter unique to be consistent with the constraint.
SQL -8551
Cause. The Distribution Service returned error NSK_err on detail text.
Effect. SQL/MX is unable to run the statement.
Recovery. Use the error in the message to diagnose and correct the problem. When
73 is returned by NSK_err, this indicates the disk file or record is locked. Because
there are numerous types of -8551 errors that can be returned to a client, the NSJMS
C++ API internals will return 73 from a call to NSJMS_SQLError::getErrorCode()
to differentiate between an -8551/73 error and other -8551/nnn errors.
Recovering within Producer::send() Operations
Producer::send() operations will occasionally encounter SQL -8551 and SQL
-8102 and should be retried. Using the retry logic is shown in this code fragment:
const static int RETRYCNT=100;
for (int dupCount=0; dupCount<RETRYCNT; dupCount++)
{
try
{
// Starting Transaction, Sending the Message
BEGINTRANSACTION();
pProducer->send(pMsg, deliveryMode, PRIORITY,
DEFAULT_JMSEXPIRATION);
ENDTRANSACTION();
8102 The operation is prevented by a unique constraint.
8102 Error NSK_err was returned by the Distribution Service
on detail_text.