informix
Informix Guide to SQL: Reference
Environment Variables

Using Environment Variables in Windows NT

The following sections discuss setting, viewing, unsetting, and modifying environment variables for native Windows applications and command-line utilities.

Setting Environment Variables for Native Windows Applications

Native Windows Informix applications, such as the database server itself, store their configuration information in the Windows registry. To modify this information, you must use the Registry Editor, regedt32.exe.

Manipulating environment variables with the Registry Editor

  1. Launch the Registry Editor, regedt32.exe, and choose the window titled HKEY_LOCAL_MACHINE.
  2. In the left pane, double-click the SOFTWARE registry key (shown as a small, yellow file folder icon). The SOFTWARE registry key expands to show several subkeys, one of which is Informix. Continue down the tree in the following sequence:
  3. Substitute the name of your database server in place of dbservername.

  4. With the Environment registry key selected in the left pane, you should see a list of environment variables and their defined values in the right pane (for example, CLIENT_LOCALE:REG_SZ:EN_US.CP1252).
  5. Change existing environment variables if needed.
  1. Double-click the environment variable.
  2. Type the new value in the String Editor dialog box.
  3. Click OK to accept the value.

  1. Add new environment variables if needed.
  1. Choose Edit Add Value in the Registry Editor.
  2. Enter the name of the environment variable in the Value Name edit box and choose REG_SZ as the data type.
  3. Click OK and type a value for the environment variable in the String Editor dialog box.

  1. Delete an environment variable, if needed.
  1. Select the variable name.
  2. Choose Edit Delete in the Registry Editor.

For more information on using the Registry Editor, see your operating-system documentation.

Important: In order to use the Registry Editor to change database server environment variables, you must belong to either the Administrators' or Informix-Admin groups. For information on assigning users to groups, see your operating-system documentation.

Setting Environment Variables for Command-Prompt Utilities

You can set environment variables for command-prompt utilities in the following ways:

Using the System Applet to Work with Environment Variables

The System applet provides a graphical interface to create, modify, and delete system-wide and user-specific variables. Environment variables that are set with the System applet are visible to all command-prompt sessions.

To change environment variables with the System applet in the control panel

  1. Double-click the System applet icon from the Control Panel window.
  2. Click the Environment tab near the top of the window. Two list boxes display System Environment Variables and User Environment Variables. System Environment Variables apply to an entire system, and User Environment Variables apply only to the sessions of the individual user.

  3. To change the value of an existing variable, select that variable.
  4. The name of the variable and its current value appear in the boxes at the bottom of the window.

  5. Highlight the existing value and type the new value.
  6. To add a new variable, highlight an existing variable and type the new variable name in the box at the bottom of the window.
  7. Next, enter the value for the new variable at the bottom of the window and click the Set button.
  8. To delete a variable, select the variable and click the Delete button.
  9. Important: In order to use the System applet to change System environment variables, you must belong to the Administrators' group. For information on assigning users to groups, see your operating-system documentation.

Using the Command Prompt to Work with Environment Variables

The following diagram shows the syntax for setting an environment variable at a command prompt in Windows NT.

For more information on how to read syntax diagrams, see Command-Line Conventions in the introduction.

To view your current settings after one or more Informix products are installed, enter the following command at a command prompt.

Sometimes you must add information to an environment variable that is already set. For example, the PATH environment variable is always set in Windows NT environments. When you use an Informix product, you must add the name of the directory where the executable files for the Informix products are stored to the PATH.

In the following example, INFORMIXDIR is d:\informix, (that is, during installation, Informix products were installed in the d: \informix directory). The executable files are in the bin subdirectory, d:\informix\bin. To add this directory at the beginning of the PATH environment-variable value, use the following command:

Rather than entering an explicit pathname, you can use the value of the INFORMIXDIR environment variable (represented as %INFORMIXDIR%), as the following example shows:

You might prefer to use this version to ensure that your PATH entry does not contradict the path that was set in INFORMIXDIR and to avoid resetting PATH whenever you change INFORMIXDIR.

For more information about setting and modifying environment variables, refer to your operating-system manuals.

Using dbservername.cmd to Initialize a Command-Prompt Environment

Each time that you open a Windows NT command prompt, it acts as an independent environment. Therefore, environment variables that you set within it are valid only for that particular command-prompt instance. For example, if you open one command prompt and set the variable, INFORMIXDIR, and then open another command prompt and type set to check your environment, you will find that INFORMIXDIR is not set in the new command-prompt session.

The database server installation program creates a batch file that you can use to configure command-prompt utilities, ensuring that your command-prompt environment is initialized correctly each time that you run a command-prompt session. The batch file, dbservername.cmd, is located in %INFORMIXDIR%, and is a plain text file that you can modify with any text editor. If you have more than one database server installed in %INFORMIXDIR%, there will be more than one batch file with the .cmd extension, each bearing the name of the database server with which it is associated.

To run dbservername.cmd from a command prompt, type dbservername or configure a command prompt so that it runs dbservername.cmd automatically at start up.

Rules of Precedence

When an Informix product accesses an environment variable, normally the following rules of precedence apply:

  1. The highest precedence goes to the value that is defined in the environment by explicitly setting the value at the command prompt.
  2. The second highest precedence goes to the value that is defined in the System control panel as a User Environment Variable.
  3. The third highest precedence goes to the value that is defined in the System control panel as a System Environment Variable.
  4. The lowest precedence goes to the default value.
  5. Important: Because Windows NT services access only environment variables that are set in the registry, the preceding rules of precedence do not apply for Informix native Windows applications. For native Windows applications, the highest precedence goes to variables that are explicitly defined in the registry, and the lowest precedence goes to the default value. In addition, if you set one or more environment variables before you start the database server, and you do not explicitly set the same environment variables for your client products, the clients will adopt the original settings.


Informix Guide to SQL: Reference, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved