User Guide

SAP AG November 2002
}
finally {
if (tableDef != null) {
tableDef.close ();
}
}
}
}
UNICODE in Programming Languages
JDBC, ODBC, the C/C++ Precompiler and Python support UNICODE [Page 152].
JDBC
Since Java works with UNICODE strings, it can read and write UNICODE columns.
If you also want to use UNICODE in SQL statements, you must set the unicode
CONNECT-property to true. SQL statements are then transferred to the database instance
in UTF-16/UCS-2 format. If the transfer package for the SQL statements is not large enough,
you can increase its size using database parameter _PACKET_SIZE.
ODBC
UNICODE is supported in the ODBC driver.
Depending on your operating system, you must take account of the following factors:
Operating
system
Windows 2000 The ODBC driver only exports the UNICODE and/or Wide functions of the
ODBC-API. ANSI functions are mapped to the relevant Wide functions by the
Windows Driver Manager . This means that applications can use both the
ANSI and the UNICODE functions of the ODBC-API.
UNIX/Linux The use of the ODBC driver is currently not possible on platforms for which
the standard UNICODE type WCHAR_T is defined with four bytes. 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 functionality of a Driver Manager can be
statically linked with the ODBC driver.
C/C++ Precompiler
During CONNECT, the C/C++ Precompiler checks whether the database is UNICODE-
enabled (Database parameter _UNICODE [Page
92] = YES). In UNICODE-enabled
database, all SQL commands are transferred as UNICODE to the database instance.
EXEC SQL BEGIN DECLARE SECTION;
/* "SELECT tablename FROM domain.tables" encoded in UCS2
*/
SQLUCS2 sqlstmt[36] =
{0x0053, 0x0045, 0x004C, 0x0045,
0x0043,
0x0054, 0x0020, 0x0054, 0x0041,
0x0042,
User Manual: SAP DB 96