Entering content frame

 UNICODE 

Data types such as CHAR ASCII are mainly suited to English and central European languages. With other character sets, a code attribute is usually used for these data types. This code attribute uses a different presentation code from ASCII, even for internal storage in the database system. This causes problems if you want to access these database systems using a different character set, or if you want to exchange data between database systems with different character sets.

You can avoid these problems by using character coding in accordance with UNICODE. UNICODE is an international standard and is able to express any characters used in an alphabet in a single character set.

For metadata and application data, a UNICODE database implements UNICODE in accordance with ISO 10646. Internally, the data is stored in UTF-16/UCS-2.

The storage of data in the UTF-16/UCS-2 format requires twice as much memory as storage in ASCII. This is because the data is encoded as 16 bit instead of 8 bit.

UNICODE in Database Interfaces

SQL statements can contain both UNICODE literals and UNICODE identifiers. The prerequisite for implementing these SQL statements in a UNICODE-compliant database instance is a UNICODE-compliant client (C/C++ Precompiler, JDBC, ODBC, or the query tools SQL Studio and Web SQL Studio).

The database interfaces JDBC, ODBC, the C/C++ Precompiler, and Python support UNICODE.

Database Interface

Special UNICODE Features

JDBC

Since Java works with UNICODE strings, it can read and write UNICODE columns. If you also want to use UNICODE in SQL statements, set the UNICODE CONNECT property to true. SQL statements are then sent to the database instance in UTF-16/UCS-2 format.

See also Example

ODBC

Microsoft Windows:

From Version 7.4.03.26, the database software includes both a UNICODE-compliant ODBC driver and a driver without UNICODE.

The driver MaxDB (Unicode) (or SAP DB (Unicode)) corresponds to the previous driver SAP DB 7.4. It implements the UNICODE interface from ODBC (such as SQLConnectW) and communicates with a UNICODE-compliant database kernel using UNICODE only. It uses ASCII to communicate with a non-UNICODE-compliant kernel.

The driver MaxDB (or SAP DB) implements the ASCII interface from ODBC (without Wide functions such as SQLConnectW) and uses only ASCII to communicate with the database kernel. This communication is more efficient (produces a smaller network load) and has fewer restrictions, for example, on the maximum length of SQL statements.

UNIX/Linux:

The use of the ODBC driver is currently not possible on platforms for which the standard UNICODE type WCHAR_T with four bytes is defined. The database and ODBC driver process UNICODE internally as values that are two bytes long.

Both the ANSI and UNICODE variants of the ODBC-API are defined in the driver.

Applications that do not require the functions of a driver manager can be linked statically with the ODBC driver.

C/C++ Precompiler

You can work with UNICODE data. When a database session is opened, the C/C++ Precompiler checks whether the database is UNICODE-compliant.

Python

Python 2.x: UNICODE columns can be read and written. UNICODE character strings cannot be used as SQL statements.

Python 1.5.2: UNICODE output values are converted to ASCII. If this conversion fails, an error is reported.

 

 

Leaving content frame