Informix Error -354
-354 Incorrect database or cursor name format.
This statement contains the name of a database or a cursor in some invalid format. If the statement is part of a program, the name might have been passed in a host variable.
The maximum length for database names and cursor names depends on the database server. In IBM Informix Dynamic Server 9.2x or later, the maximum length is 128 characters. For IBM Informix SE, database names should be no longer than 10 characters (fewer in some host operating systems). In other Informix database servers, the maximum length is 18 characters.
Both database and cursor names must begin with a letter and contain only letters, numbers, and underscore characters. In IBM Informix OnLine Dynamic Server and later Informix database servers, database and cursor names can begin with an underscore. In Dynamic Server 9.2x or later, these names can include dollar-sign characters.
In MS-DOS systems, filenames can be a maximum of 8 characters plus a 3-character extension.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-354 fires when a database or cursor name in a statement doesn't follow Informix's identifier naming rules: names must begin with a letter, and otherwise contain only letters, numbers, and underscores (some newer versions also allow a leading underscore or a dollar sign). Maximum length also varies significantly by server version — from as little as 10 characters on older systems up to 128 characters on Dynamic Server 9.2x and later.
- A name starting with a digit or a disallowed symbol — most identifiers must begin with a letter.
- A name containing a disallowed character — spaces, hyphens, or other punctuation beyond underscores aren't valid in a database or cursor name.
- A name exceeding the server version's maximum length — a name that's fine on a newer Dynamic Server (128 characters) may be rejected on an older system with a much shorter limit.
- Assuming a newer version's relaxed rules (leading underscore, dollar sign) apply when the actual target server is older and doesn't support them.
Solutions / Resolution
- Ensure the name begins with a letter and contains only letters, numbers, and underscores, per the official guidance, unless targeting a version confirmed to support the relaxed rules.
- Check the target server version's maximum identifier length and keep names within it — don't assume the newer, longer limit applies universally.
- Avoid relying on version-specific relaxed naming rules (leading underscore, dollar sign) in code meant to be portable across server versions.
Examples
A name starting with a digit
DATABASE 2024_sales;
-- -354: names must begin with a letter
Fix:
DATABASE sales_2024;
A name exceeding an older server's length limit
-- A 20-character cursor name, fine on newer Dynamic Server,
-- but too long on an older system limited to 10 characters:
DECLARE very_long_cursor_name CURSOR FOR ...;
Fix — shorten the name if targeting an older server:
DECLARE short_curs CURSOR FOR ...;
Diagnostic Checks
- Check the name against the basic rule: starts with a letter, only letters/numbers/ underscores otherwise (unless the target version is confirmed to allow more).
- Check the target server version's maximum identifier length, and compare against the name's actual length.
Related Errors / Related Topics
- -201 — "A syntax error has occurred." The general SQL-parsing-error family this fits into.
Naming rules and length limits both vary meaningfully by server version — check the actual target version's rules rather than assuming the most permissive (newest) ones apply.