Informix Error -700: Statement is invalid within a global transaction.
Cause and resolution
Statement is invalid within a global transaction.
This error is generated when a user attempts to execute a BEGIN WORK, COMMIT WORK, or ROLLBACK WORK statement within a global transaction.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-700 fires when BEGIN WORK, COMMIT WORK, or ROLLBACK WORK is issued while a global
(distributed/XA) transaction is already in progress — per the official guidance, transaction
boundary control belongs to the external transaction manager in this environment, not to
ordinary SQL statements.
- Application code issuing
BEGIN WORK/COMMIT WORK/ROLLBACK WORKinside a global transaction, per the official guidance — the direct, only cause. - Code written for standalone (non-XA) use, reused inside an XA-managed connection without removing its own transaction-boundary statements, since the external transaction manager already controls those boundaries in this environment.
Solutions / Resolution
- Remove
BEGIN WORK/COMMIT WORK/ROLLBACK WORKfrom code that runs inside a global transaction, per the official guidance — let the external transaction manager (viaxa_start/xa_end/xa_commit/xa_rollback) control the transaction boundary instead. - Audit code paths that might run either standalone or inside an XA-managed connection, ensuring the transaction-boundary statements are only issued in the standalone case.
Examples
The disallowed attempt
-- Inside an XA global transaction:
BEGIN WORK;
-- -700: transaction boundaries are controlled by the XA transaction manager here
Corrected — no explicit transaction-boundary statement
/* The XA transaction manager already opened the global transaction
via xa_start(); just run the work, then let it call xa_end()/xa_commit(). */
UPDATE orders SET status = 'shipped' WHERE order_id = 42;
Diagnostic Checks
- Check whether the connection is currently inside an XA global transaction, and remove any
BEGIN WORK/COMMIT WORK/ROLLBACK WORKfrom code paths that run there.
Related Errors / Related Topics
- -701 — "Statement is invalid within the XA environment." A related restriction, naming a
broader list of statements (including
CREATE DATABASE,SAVEPOINT, and others) disallowed in the XA environment. - -702 — "Cannot open database in exclusive mode." A related XA-environment restriction, on a specific database-open mode.
Transaction boundaries in an XA global transaction are controlled by the external transaction
manager — remove BEGIN/COMMIT/ROLLBACK WORK from code running inside one.