Configuring NLS_LANG

This topic describes how to properly use the NLS_LANG variable.

Using NLS_LANG correctly

StarTeam Server converts data that is stored in the database to UTF-8 format. Your database character set should be defined such that it will not conflict with this nor with other StarTeam Server requirements. For more information, see Defining NLS_LANG in the Windows registry .

NLS_LANG represents the Oracle Client character set. The Oracle Client character set is defined by the third part of the NLS_LANG parameter and must be set to a value that Server uses.

After setting NLS_LANG correctly, Oracle Client correctly translates any symbols to the character code values of the database character set when storing data into the database or retrieving data from the database. NLS_LANG is specified in the following format.

NLS_LANG = language_territory.characterset
language Specifies the language used for Oracle messages, day names, and month names.
territory Specifies the monetary and numeric formats, territory, and conventions for calculating week and day numbers.
characterset Controls the character set used by Oracle Client. (Normally it matches your Microsoft Windows code page.)

Back to top

NLS_LANG definition overview

The ODBC installation supports multiple Oracle homes. Each ODBC driver is uniquely identified by the name of the Oracle home in which it is installed. Applications using Oracle ODBC drivers use the value of NLS_LANG for making decisions related to character set conversion. The character set portion of the NLS_LANG setting must be AMERICAN_AMERICA.WE8MSWIN1252. If your database was previously Oracle 8i, then you use AMERICAN_AMERICA.WE8ISO8859P1.

The ODBC driver installation uses the value of the Windows code page (ACP) and defines the value of NLS_LANG in the registry. The value of NLS_LANG should be verified for accuracy. Be sure to check for the NLS_LANG environment variable because it will override the registry setting. You may choose to delete the variable. For more information, see Defining the NLS_LANG as an Environment Variable.

You can define NLS_LANG for the Oracle Client in either of the following ways:

In the Registry (Microsoft Windows only) Oracle Client and Server support the concept of multiple Oracle homes. What this means is that you can have multiple sets of Oracle binaries on the same computer. When you have multiple Oracle homes on the same computer, you have multiple registry entries for each home. NLS_LANG should be defined for each home.
As an environment variable Although the Registry is the primary repository for environment settings, it is not the only place where environment parameters can be set. You can set the NLS_LANG as a System or User Environment Variable in the System properties.
Caution: If NLS_LANG is defined as an environment variable, it will be used for all Oracle homes. This option should be used with caution, especially for cases where there are multiple Oracle homes on the computer and some Oracle homes have different NLS_LANG settings. It may be best to delete it.

Back to top

Defining NLS_LANG in the Windows registry

Note: If NLS_LANG is not defined, it defaults to AMERICAN_AMERICA.US7ASCII and must be changed to a value that Server uses.

To change the NLS_LANG setting using the Microsoft Windows Registry Editor:

  1. Click Start > Run. The Run dialog box opens.
  2. Type regedit, and then click OK.
  3. Edit the following registry entry: HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\homeID where homeID is the unique name identifying the Oracle home.

Back to top

Defining the NLS_LANG as an environment variable

If NLS_LANG is not defined, it defaults to AMERICAN_AMERICA.US7ASCII and must be changed to a value that Server uses. To create or modify this setting for Linux, define the value of NLS_LANG in the .profile or .cshrc file. Contact your Linux Admin to learn how to set environment variables.

To create or modify the NLS_LANG environment variable’s setting on Microsoft Windows:

  1. Right-click the My Computer icon on your desktop, and then choose Properties from the context menu.
  2. Select the Advanced tab.
  3. Click Environment Variables. The Environment Variables dialog box opens.
  4. Select NLS_LANG and define an appropriate value.

Back to top