|
The following sections discuss setting, unsetting, modifying, and viewing environment variables. If you already use an Informix product, some or all of the appropriate environment variables might be set.
The common (shared) environment-configuration file that is provided with Informix products resides in $INFORMIXDIR/etc/informix.rc. The permission for this shared file must be set to 644.
A user can override the system or shared environment variables by setting variables in a private environment-configuration file. This file must have the following characteristics:
An environment-configuration file can contain comment lines (preceded by #) and variable lines and their values (separated by blanks and tabs), as the following example shows:
You can use the ENVIGNORE environment variable, described on page 3-59, to override one or more entries in an environment-configuration file. Use the Informix chkenv utility, described on page 3-12, to perform a sanity check on the contents of an environment-configuration file. The chkenv utility returns an error message if the file contains a bad environment variable or if the file is too large.
The first time you set an environment variable in a shell file or environment-configuration file, you must tell the shell process to read your entry before you work with your Informix product. If you use a C shell, source the file; if you use a Bourne or Korn shell, use a period (.) to execute the file.
Add the commands that set your environment variables to the following login file:
Use standard UNIX commands to set environment variables. The examples in the following table show how to set the ABCD environment variable to value for the C shell, Bourne shell, and Korn shell. The Korn shell supports a shortcut, as the fourth item indicates. The environment variables are case sensitive.
| Shell | Command |
|---|---|
| C | setenv ABCD value |
| Bourne |
ABCD=value export ABCD |
| Korn |
ABCD=value export ABCD |
| Korn | export ABCD=value |
The following diagram shows how the syntax for setting an environment variable is represented throughout this chapter. These diagrams indicate the setting for the C shell; for the Bourne or Korn shells, use the syntax illustrated in the preceding table.
For more information on how to read syntax diagrams, see Command-Line Conventions in the Introduction.
To unset an environment variable, enter the following command.
| Shell | Command |
|---|---|
| C | unsetenv ABCD |
| Bourne or Korn | unset ABCD |
Sometimes you must add information to an environment variable that is already set. For example, the PATH environment variable is always set in UNIX environments. When you use an Informix product, you must add to the PATH the name of the directory where the executable files for the Informix products are stored.
In the following example, the INFORMIXDIR is /usr/informix. (That is, during installation, the Informix products were installed in the /usr /informix directory.) The executable files are in the bin subdirectory, /usr/informix/bin. To add this directory to the front of the C shell PATH environment variable, 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 so that you do not have to reset PATH whenever you change INFORMIXDIR.
If you set the PATH environment variable on the C shell command line, you might need to include curly braces with the existing INFORMIXDIR and PATH, as the following command shows:
For more information about setting and modifying environment variables, refer to the manuals for your operating system.
After you have installed one or more Informix products, enter the following command at the system prompt to view your current environment settings.
The chkenv utility checks the validity of shared or private environment-configuration files. It validates the names of the environment variables in the file but not their values. Use chkenv to provide debugging information when you define, in an environment-configuration file, all the environment variables that your Informix products use
.
| Element | Purpose | Key Considerations |
|---|---|---|
| filename | Specifies the name of the environment-configuration file that you want to debug. | None |
The shared environment-configuration file is stored in $INFORMIXDIR/etc/informix.rc. A private environment-configuration file is stored in the user's home directory as .informix.
If you do not provide the filename for chkenv, the utility checks both the shared and private environment configuration files. If you provide a file path, chkenv checks only that file.
Issue the following command to check the contents of the shared environment-configuration file:
The chkenv utility returns an error message if it finds a bad environment-variable name in the file or if the file is too large. You can modify the file and rerun the utility to check the modified environment-variable names.
Informix products ignore all lines in the environment-configuration file, starting at the point of the error, if the chkenv utility returns the following message:
If you want the product to ignore specified environment-variables in the file, you can also set the ENVIGNORE environment variable. For a discussion of the use and format of environment-configuration files and the ENVIGNORE environment variable, see page 3-59.
When an Informix product accesses an environment variable, normally the following rules of precedence apply:
For precedence information about GLS environment variables, see the Informix Guide to GLS Functionality.
Important: 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.