Home | Previous Page | Next Page   GLS Fundamentals > Setting a GLS Locale >

Locales in the Client/Server Environment

In a client/server environment, the client application, database server, and one or more databases might reside on different computers. Figure 1 shows an example of database server connections between an ESQL/C client application and the acctng database through an Informix database server.

Figure 1. Example of a Client/Server Environment
begin figure description - This figure is described in the surrounding text. - end figure description

These computers might have different operating systems or different language support. To ensure that these three parts of the database application communicate locale information successfully, IBM Informix products support the following locales:

Figure 2 shows the client locale, database locale, and server locale that the example ESQL/C application (from Figure 1) establishes.

Figure 2. The Client Locale, Database Locale, and Server Locale
begin figure description - This figure is described in the surrounding text. - end figure description

When you set the same or compatible GLS locales for each of these locales, your client application is not dependent on how the operating system of each computer implements language-specific features.

Sections that follow describe each of these locales in more detail.

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 (end-user formats), embedded SQL (ESQL) statements, and host variables.

IBM Informix products use the CLIENT_LOCALE environment variable for the following purposes:

In the example connection that Figure 2 shows, if the client locale is German with the Windows Code Page 1252 (de_de.1252@euro), the German locale-specific information that the ESQL/C client application uses includes the following:

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 end-user formats of the client locale, a client application uses the following precedence:

  1. DBDATE and DBTIME environment variables for the end-user formats of date and time data and DBMONEY for the end-user format of monetary data (if one of these is set)
  2. GL_DATE and GL_DATETIME environment variables for the end-user formats of date and time data (if one of these is set)
  3. The information that the client locale defines (CLIENT_LOCALE, if it is set)
  4. The default locale (U.S. English)
Dynamic Server

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

End of Dynamic Server

Support for DBDATE and DBTIME provides backward compatibility for client applications based on earlier versions of IBM Informix products. We recommend that you use GL_DATE and GL_DATETIME for new applications.

The Database Locale

The database locale, which is set with the DB_LOCALE environment variable, specifies the language, territory, and code set that the database server needs to correctly interpret locale-sensitive data types (NCHAR and NVARCHAR) in a particular database. The code set specified in DB_LOCALE determines which characters are valid in any character column, as well as the names of database objects such as databases, tables, columns, and views. For more information, see Naming Database Objects.

The database locale also specifies the writing direction. Most languages are written left-to-right, but some are written right-to-left or top-to-bottom.

IBM Informix products use the DB_LOCALE environment variable for the following purposes:

The database server stores a condensed version of the database locale in the systables system catalog table.

When the database server stores the database locale information directly in the system catalog, it permanently attaches the locale to the database. This information is used throughout the lifetime of the database. In this way, the database server can always determine the locale that it needs to interpret the locale-sensitive data correctly.

Dynamic Server

The SET COLLATION statement can specify the localized collation of a different locale to sort NCHAR and NVARCHAR data in the current session.

End of Dynamic Server

The condensed version of the database locale is stored in the following two rows of systables, which store the condensed locale name in the site column:

The database server uses the value of the DB_LOCALE environment variable that the client application sends. If you do not set DB_LOCALE on the client computer, however, the database server uses the value of DB_LOCALE on the server computer as the database locale.

In the connection shown in Figure 2, the database server references the database locale when the client application requests sorted information for an NCHAR column in the acctng database. If this locale is German with the Windows Code Page 1252 (de_de.1252), the database server uses a localized order that sorts accented characters, such as ö, after their unaccented counterparts. Thus, the string öff sorts after ord but before pre. For the syntax to set the database locale, see DB_LOCALE.

The Server Locale

The server locale, which is set with the SERVER_LOCALE environment variable, specifies the language, territory, and code set that the database server uses to perform read and write (I/O) operations on the server computer (the computer on which the database server runs). These I/O operations include reading or writing the following files:

The database server does not use the server locale, however, to write files that are in an Informix proprietary format (database and table files). For a more detailed description of the files that the database server writes using the server locale, see Database Server Features.

The database server looks for product-specific message files in the message directory that is associated with the locale specified in SERVER_LOCALE. For more information, see Locating Message Files.

In the example connection that Figure 2 shows, the Informix database server uses the locale specified in SERVER_LOCALE to determine the code set to use when it writes a message-log file. For the syntax to set the server locale, see SERVER_LOCALE.

Tip:
The database server is the only IBM Informix product that needs to know the server locale. Any database server utilities that you run on the server computer use the client locale to read from and write to files and the database locale (on the server computer) to access databases that are set on the server computer.

Note:
The server locale and the server-processing locale are two different locales. For more information about the server-processing locale, see Determining the Server-Processing Locale.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]