Informix Error -571: Cannot reference an external non-ANSI database.
Cause and resolution
Cannot reference an external non-ANSI database.
This statement refers to a database other than the current database. However, the current database is ANSI compliant, and the external one is not. This action is not supported; the databases used in a single transaction must all be ANSI compliant, or all must not be.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-571 is the mirror image of -570: it fires when a statement in an ANSI-compliant current database references an external database that is not ANSI-compliant — per the official guidance, all databases participating in a single transaction must either all be ANSI-compliant or all not be.
- A cross-database reference from an ANSI-compliant database to a non-ANSI one, per the official guidance — the direct, only cause.
- An ordinary (non-ANSI) staging or reporting database referenced from an ANSI-compliant
(
MODE ANSI) application database within the same transaction. - A database's ANSI-compliance mode assumed to match another's, without checking, when writing cross-database SQL spanning the two.
Solutions / Resolution
- Restructure the operation to avoid a same-transaction cross-database reference between databases with different ANSI-compliance modes, per the official guidance's underlying requirement.
- Move data between the databases via unload/load instead of an in-transaction cross-database reference, if both databases' ANSI-compliance modes are intentional and fixed.
- Check a database's ANSI-compliance mode before writing cross-database SQL against it:
SELECT name, is_ansi FROM sysmaster:sysdatabases WHERE name = 'target_db';
Examples
The disallowed cross-database reference
DATABASE ansi_compliant_db; -- ANSI-compliant
SELECT * FROM ordinary_db:accounts;
-- -571: ordinary_db is not ANSI-compliant
Checking ANSI-compliance modes first
SELECT name, is_ansi FROM sysmaster:sysdatabases
WHERE name IN ('ansi_compliant_db', 'ordinary_db');
Diagnostic Checks
- Query
sysmaster:sysdatabasesfor theis_ansistatus of both the current and the referenced external database, to confirm the mismatch before deciding how to resolve it.
Related Errors / Related Topics
- -568 — "Cannot reference an external database without logging." Same family of cross-database mode consistency restrictions, for logging.
- -569 — "Cannot reference an external database with logging." Same family, the mirror-image logging restriction.
- -570 — "Cannot reference an external ANSI database." The mirror-image restriction: a non-ANSI current database referencing an ANSI-compliant external one.
The mirror image of -570 — same underlying rule (all databases in a transaction must share an ANSI-compliance mode), triggered from the opposite direction.