The client locale

The client locale specifies the language, territory, and code set that the client application uses to perform read and write (I/O) operations.

In a client application, I/O operations include reading a keyboard entry or a file for data to be sent to the database and writing data that the database server retrieves from the database to the screen, a file, or a printer. In addition, an SQL API client uses the client locale for literal strings (display formats), embedded SQL (ESQL) statements, and host variables.

HCL OneDB™ products use the CLIENT_LOCALE environment variable for the following purposes:
  • When the preprocessor for processes a source file, it accepts C source code that is written in the code set of the CLIENT_LOCALE.

    The C compiler and the operating system that you use might impose limitations on the program. For more information, see Generate non-ASCII file names.

  • When the client application executes, it checks CLIENT_LOCALE for the name of the client locale, which affects operating-system file names, contents of text files, and formats of date, time, and numeric data.

    For more information, see Handle non-ASCII characters.

  • When a client application and a database server exchange character data, the client application performs code-set conversion when the code set of the CLIENT_LOCALE environment variable is different from the code set of DB_LOCALE (on the client computer).

    Code-set conversion prevents data corruption when these two code sets are different. For more information, see Perform code-set conversion.

  • When the client application requests a connection, it sends information, including the CLIENT_LOCALE, to the database server.

    The database server uses CLIENT_LOCALE when it determines how to set the client-application information of the server-processing locale. For more information, see Establish a database connection.

  • When database utilities create files, the file names and file contents are in the code set that CLIENT_LOCALE specifies.
  • When a client application looks for product-specific message files, it checks the message directory associated with the client locale.

    For more information, see Locate message files.

In the example connection that The client locale, database locale, and server locale shows, if the client locale is German with the Windows™ Code Page 1252 (de_de.1252@euro), the German locale-specific information that the client application uses includes the following:
  • Valid date display formats support the following format for the U.S. English date of Tuesday, 02/11/1997:
    Di., 11. Feb 1997
  • Valid monetary display formats support the following format for the U.S. English amount of $354,446.02:
    EUR354.446,02
Tip: To provide this information for the client locale, the locale file contains the following locale categories: COLLATION, CTYPE, TIME, MONETARY, and NUMERIC. For more information, see Locale categories.
To determine the client locale, client applications use environment variables set on the client computer. To obtain the localized order and display formats of the client locale, a client application uses the following precedence:
  1. DBDATE and DBTIME environment variables for the display formats of date and time data and DBMONEY for the display format of monetary data (if one of environment variables is set)
  2. GL_DATE and GL_DATETIME environment variables for the display formats of date and time data (if one of environment variables is set)
  3. The information that the client locale defines (CLIENT_LOCALE, if it is set)
  4. The default locale (U.S. English)

Client applications that are based on use the precedence of steps 2, 3, and 4 in the preceding list. You do not need to set the other environment variables for HCL OneDB client applications.

Support for DBDATE and DBTIME provides compatibility with earlier versions for client applications based on earlier versions of HCL OneDB products. It is recommended that you use GL_DATE and GL_DATETIME for new applications.