SQL portability / CHAR and VARCHAR types |
This section explains database server specifics regarding Unicode / UTF-8 support with character string SQL types.
All database servers can store UNICODE data in character strings types, but there are some specifics you must be aware of. Genero BDL programs typically use the CHAR and VARCHAR types to store UTF-8 strings. But the correspond SQL type may have a different name, according to the database server type. Use the correct SQL type when creating you database tables. When the database uses a different UNICODE codeset as UTF-8 to store the character string data, the database client or the Genero database driver take care of the codeset conversion, as long as the runtime system and database client locale are properly defined.
Database Server Type | Char types to be used for Unicode/UTF-8 |
---|---|
IBM® DB2® UDB | CHAR /
VARCHAR if the database was created with UTF-8 codeset. Otherwise, you
must use GRAPHIC, VARGRAPHIC types. For more details, see CHARACTER data types. |
IBM Informix® | CHAR / VARCHAR, the database must be created with UTF-8 locale. |
IBM Netezza | NCHAR /
NVARCHAR (data always stored in UTF-8). For more details, see CHARACTER data types. |
Microsoft™ SQL Server | NCHAR /
NVARCHAR, to store UTF-16 data (drivers make the conversion for
application codeset UTF-8) The CHAR/VARCHAR types can only store non-unicode data. For more details, see CHARACTER data types. |
Oracle MySQL | CHAR /
VARCHAR if the database locale is UTF-8. NCHAR / NVARCHAR if you need to use the national character set. For more details, see CHARACTER data types. |
Oracle Database Server | CHAR /
VARCHAR2 if the database locale is UTF-8. NCHAR / NVARCHAR2 if you need to use the national character set. For more details, see CHARACTER data types. |
PostgreSQL | CHAR / VARCHAR, the database locale must be UTF-8. For more details, see CHARACTER data types. |
Sybase ASE | CHAR /
VARCHAR if the database locale is UTF-8. NCHAR / NVARCHAR or UNICHAR / UNIVARCHAR if you need to use the national character set. For more details, see CHARACTER data types. |
SQLite | CHAR / VARCHAR (data always stored in UTF-8). For more details, see CHARACTER data types. |