SQL character type for Unicode/UTF-8

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 corresponding SQL type may have a different name, depending on the database server type. Use the correct SQL type when creating your 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.

Table 1. Database server character types for Unicode / UTF-8 data
Database Server Type Char types to be used for Unicode/UTF-8
IBM® DB2® LUW CHAR / VARCHAR if the database was created with UTF-8 codeset. Otherwise, you must use GRAPHIC, VARGRAPHIC types.

For more details, see the topic about character data type usage with IBM DB2.

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 the topic about character data type usage with IBM Netezza.

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 the topic about character data type usage with Microsoft SQL Server.

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 the topic about character data type usage with Oracle MySQL.

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 the topic about character data type usage with Oracle DB.

PostgreSQL

CHAR / VARCHAR, the database locale must be UTF-8.

For more details, see the topic about character data type usage with PostgreSQL.

SAP® 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 the topic about character data type usage with SAP ASE.

SAP HANA®

CHAR / VARCHAR: For ASCII-7 only.

NCHAR / NVARCHAR: For ISO-* single byte character sets and UNICODE / UTF-8.

For more details, see the topic about character data type usage with SAP HANA.

SQLiteSAP HANA®

CHAR / VARCHAR (data always stored in UTF-8).

For more details, see the topic about character data type usage with SQLite.