Informix Error -942: Transaction commit failed - transaction will be rolled back.
Cause and resolution
Transaction commit failed - transaction will be rolled back.
This error can occur at transaction-commit time if an error is raised when a DataBlade routine calls a UDR-registered end-of-transaction (MI_EVENT_END_XACT) callback. You have registered a callback for the MI_EVENT_END_XACT (or MI_Xact_State_Change) event in the context of a server routine. When the end-of-transaction (MI_EVENT_END_XACT) event occurred to commit the transaction, an error was raised.
Within a DataBlade routine, you can use the mi_error_desc_next() function to obtain the next error, which should explain the cause of the failure. Currently, the end-of-transaction (MI_EVENT_END_XACT) event occurs only within the context of a DataBlade server routine. It does not occur within the context of a DataBlade client application.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-942 fires at transaction-commit time when a DataBlade routine's registered end-of-transaction
callback (MI_EVENT_END_XACT, also referred to as MI_Xact_State_Change) itself raises an
error during the commit — per the official guidance, this is specific to server-side DataBlade
routines that registered such a callback; it doesn't occur in DataBlade client applications.
- A registered
MI_EVENT_END_XACTcallback's own logic raising an error during commit, per the official guidance — the direct, only cause. - A DataBlade routine's end-of-transaction logic encountering a condition it treats as fatal, specific to that DataBlade's own design.
Solutions / Resolution
- Use
mi_error_desc_next()within the DataBlade routine to obtain the next error, per the official guidance — this should explain the specific cause of the failure, since -942 itself is a generic wrapper around the callback's own raised error. - Consult the documentation for the specific DataBlade involved, since the callback's error logic and its meaning are defined by that DataBlade's own implementation, not the core server.
- The transaction is automatically rolled back, per the official guidance's own message
text — no separate
ROLLBACK WORKis needed; the failed commit already triggers this.
Examples
Retrieving the underlying error within a DataBlade routine
/* Within the callback's error-handling code, call mi_error_desc_next()
to step through the chained error descriptors and find the one
describing the actual failure -- consult the DataBlade API Function
Reference for the exact signature on the server version in use. */
Diagnostic Checks
- Use
mi_error_desc_next()to retrieve the specific error theMI_EVENT_END_XACTcallback raised. - Confirm which DataBlade registered the callback, and consult that DataBlade's own documentation for the error's meaning.
Related Errors / Related Topics
- -937 — "User Defined Routine error." A related DataBlade/UDR error-wrapper, where the
specific cause similarly lives in a value the UDR itself set (
SQLSTATEthere, versusmi_error_desc_next()here).
A generic wrapper around a DataBlade's own end-of-transaction callback error — use
mi_error_desc_next() to find the specific cause; the transaction is already rolled back
automatically.