Search code examples
databaseinformix

How do I escape reserved words used as identifier in Informix


One can use delimited identifier in JDBC query and it works with below databases even for a non reserved keyword with below delimiters:

SQLServer: Square bracket => [select]

Postgres, Teradata, Oracle, Sybase and DB2: double quote => "select"

HIVE and MYSQL: backtick => `select`

Informix documentation says double quote can be used as delimiter to escape, but it does not work.

Any insight will be helpful.


Solution

  • If you are using the informix JDBC version 4.10 (not sure if it is supported in previous versions) you can pass the DELIMIDENT=Y parameter either in the connection string or through a properties list.

    DELIMIDENT 
    When set to Y, specifies that strings set off by 
    double quotation marks are delimited identifiers
    

    Check out the documentation: Informix environment variables with the IBM Informix JDBC Driver