SQL adaptation guide For IBM DB2 UDB 8.x, 9x / Data dictionary |
Informix® supports the following character data types:
In Informix, both CHAR/VARCHAR and NCHAR/NVARCHAR data types can be used to store single-byte or multibyte encoded character strings. The only difference between CHAR/VARCHAR and NCHAR/NVARCHAR is for sorting: N[VAR]CHAR types use the collation order, while [VAR]CHAR types use the byte order. The character set used to store strings in CHAR/VARCHAR/NCHAR/NVARCHAR columns is defined by the DB_LOCALE environment variable. The character set used by applications is defined by the CLIENT_LOCALE environment variable. Informix uses Byte Length Semantics (the size N that you specify in [VAR]CHAR(N) is expressed in bytes, not characters as in some other databases)
IBM® DB2® implements the following character data types:
Like Informix, IBM DB2 uses Byte Length Semantics to define the length of CHAR/VARCHAR columns. However, GRAPHIC and VARGRAPHIC lengths are specified in characters (i.e. max number of double-byte characters).
The character set used by DB2 to store CHAR and VARCHAR data is defined in the database locale section when creating a new database with the DB2 Control Center.
DB2 can automatically convert from/to the client and server characters sets. In the client applications, you define the character set with the DB2CODEPAGE profile variable.
Informix CHAR(N) types must be mapped to BD2 CHAR(N) types, and Informix VARCHAR(N) or LVARCHAR(N) columns must be mapped to DB2 VARCHAR(N).
When extracting a database schema from a DB2 database, the schema extractor uses the size of the column in characters, not the octet length. If you have created a CHAR(10 (characters) ) column a in DB2 database using the UTF-8 character set, the .sch file will get a size of 10, that will be interpreted according to FGL_LENGTH_SEMANTICS as a number of bytes or characters.
Do not forget to properly define the database client character set, which must correspond to the runtime system character set.
See also the section about Localization.