Informix Error -702: Cannot open database in exclusive mode.
Cause and resolution
Cannot open database in exclusive mode.
Within an X/Open distributed transaction processing environment, you cannot open a database in exclusive mode.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-702 fires when a database is opened in exclusive mode within an X/Open distributed transaction-processing (XA) environment — per the official guidance, exclusive-mode access isn't supported there at all.
DATABASE dbname EXCLUSIVE(or an equivalent exclusive-open mechanism) issued inside the XA environment, per the official guidance — the direct, only cause.- Application code written for standalone administrative use (where exclusive mode is a normal way to guarantee sole access for a bulk operation) reused inside an XA-managed connection without accounting for this restriction.
Solutions / Resolution
- Don't open the database in exclusive mode inside the XA environment, per the official guidance — this is a hard restriction, not a configurable option.
- Perform any operation that would normally need exclusive access outside the XA environment, on a standalone (non-XA) connection instead, if exclusive access is genuinely required for it.
- Rely on ordinary row/table-level locking within the XA transaction for the isolation the operation needs, if exclusive mode was being used more for convenience than a genuine requirement.
Examples
The disallowed attempt
/* Inside an XA transaction: */
DATABASE stores7 EXCLUSIVE;
-- -702: exclusive mode isn't supported in the XA environment
Corrected — perform the exclusive-access operation outside XA
/* On a standalone, non-XA connection: */
DATABASE stores7 EXCLUSIVE;
-- perform the bulk administrative operation here instead
Diagnostic Checks
- Check whether the connection attempting the exclusive-mode open is inside an XA environment, and move that specific operation to a standalone connection if so.
Related Errors / Related Topics
- -700 — "Statement is invalid within a global transaction." A related XA-environment restriction, on transaction-boundary statements.
- -701 — "Statement is invalid within the XA environment." A related, broader list of restricted statements in the same environment.
Exclusive-mode database access isn't available inside XA at all — move that specific operation to a standalone, non-XA connection.