DB Access Module for Oracle OCI User’s Guide : Chapter 2 Technical Information : Internationalization
Internationalization
The DB Interface Module internationalization features are available in the DB Access Module for Oracle OCI subject to the restrictions given in the following sections.
Prerequisites
This section discusses prerequisites.
Environment Variables
The DB Access Module for Oracle OCI does not require any specific client setting to insert or read data if your database is set up correctly to use UTF-16 encoding. However, you are advised to set the appropriate NLS_LANG in your operating system environment or Windows registry to customize the behavior of the Oracle OCI client. For customized error messages, you must set the correct locale in your environment along with NLS_LANG. NLS_LANG should be set before executing the application.
Database NLS_NCHAR_CHARACTERSET
To use internationalization features, your database should be created with NLS_NCHAR_CHARACTERSET set to AL16UTF16 or AL32UTF8. If it is set to AL32UTF8, a conversion between UTF-16 and UTF-8 encodings is initiated on the server side.
All data passed to and read back from the DB Access Module for Oracle OCI with Oracle datatypes NCHAR and NVARCHAR2 should be in UTF-16 encoding.
Database Length Semantics
NLS_LENGTH_SEMANTICS of the Oracle database can be set to byte or character semantics. Tables created under byte semantics are different than tables created under character semantics. Table created under byte semantics specify column length in bytes. Tables created under character semantics specify column length in characters. Both types of semantics are implemented as is from Oracle; the DB Access Module for Oracle OCI does not alter your statements. Please see the Oracle documentation for more details.
Data Bindings
The DB Access Module for Oracle OCI binds the Oracle datatypes NCHAR and NVARCHAR2 to RWBasicUString. It is recommended that all Unicode-enabled applications use type RWBasicUString (from the Essential Tools Module) or type RWUString(from the Internationalization Module) to handle all UTF-16 data.
Limitations
This section discusses limitations.
Using Oracle Datatypes NCHAR and NVARCHAR2
All data passed to and read back from the DB Access Module for Oracle OCI with Oracle datatypes NCHAR and NVARCHAR2 should be in UTF-16 encoding. DB Access Module for Oracle OCI allows binding UTF-8 data using RWDBMBString; however, an internal conversion to UTF-16 will occur.
Metadata
SourcePro DB does not currently support Unicode logins, passwords, or metadata.
Using RWWString in Unicode Applications
Due to platform inconsistencies, Rogue Wave recommends that you do not write Unicode applications with RWWString. On platforms where a wchar_t is defined as greater than 2 bytes, a costly conversion will occur to convert your data from 2-byte UTF-16 to 4-byte padded UTF-16. Furthermore, after the conversion, your application will still not have valid Unicode. Whether the size of wchar_t is 2 bytes or 4 bytes, the RWWString will represent only UTF-16 data, not a true wide string, as it has not been localized. Rogue Wave recommends using one of our Unicode string containers, RWBasicUString (from the Essential Tools Module) or RWUString(from the Internationalization Module).
Using RWDBMBString in Unicode Applications
RWDBMBStrings can be bound to Oracle datatypes NCHAR and NVARCHAR2 only when storing UTF-8 data. There will be an internal conversion to UTF-16 before binding the data.
Date Formats
Date expressions are loaded into the database and extracted from the database in a locale neutral manner. The DB Interface Module properly formats instances of RWDateTime and RWDate automatically. The application programmer is responsible for formatting these types outside the scope of DB Interface Module API calls.
RWDecimalPortable instances are fully supported.