Introduction to SQL Anywhere environment variables

SQL Anywhere uses environment variables to store various types of information. Not all environment variables need to be set in all circumstances.

For SQL Anywhere Server, you can view the environment variables set for a particular server by starting the server with the -ze option. See -ze server option.

Setting environment variables on Windows

The SQL Anywhere installer creates or modifies the following environment variables in your computer's properties: PATH and SQLANY11. After installing SQL Anywhere, you must restart your computer for these environment variables to take effect.

Other environment variables can be set by modifying the properties for your computer, or within command prompts or batch files by using the SET command.

Setting environment variables for the Finder in Mac OS X

The SQL Anywhere installer sets the following environment variables: DYLD_LIBRARY_PATH, ODBCINI, PATH, and SQLANY11. Rebooting is not required.

Terminal sessions do not inherit environment variables from the Finder. The following section describes how to set environment variables for terminal sessions.

Setting environment variables on Unix and Mac OS X

Once SQL Anywhere 11 is installed, each user must set some environment variables for the system to locate and run SQL Anywhere applications. The SQL Anywhere installer creates two files, sa_config.sh and sa_config.csh, for this purpose. These files are installed in install-dir/bin32 and install-dir/bin64. Each file sets all needed user environment variables.

As the names imply, one file is designed to work under Bourne shell (sh) and its derivatives (such as ksh or bash). The other file is designed to work under C-shell (csh) and its derivatives (such as tcsh).

Some statements are commented out in each of these batch files. The system administrator may want to edit these files and remove comments, depending on the configuration of their system.

To run a SQL Anywhere application, you have several choices:

  1. If you add the environment variables from the sa_config files to your system environment, you can run applications by launching them from a GUI, such as X window server, or by typing the application name in a terminal window.

  2. In a terminal window, if you source one of the sa_config files, you can run the application by typing its name.

  3. install-dir/bin32s and install-dir/bin64s contain scripts with the same names as SQL Anywhere applications. These scripts set the appropriate environment variables before launching the application. You can run the application by running the corresponding script. You do not have to source an sa_config file before you run these scripts.

Sourcing files on Unix and Mac OS X

To source a file means to execute commands contained in a text file in the current instance of the shell. This is accomplished using a command built into the shell.

Under Bourne shell and its derivatives, the name of this command is . (a single period). For example, if SQL Anywhere is installed in /opt/sqlanywhere11, the following statement sources sa_config.sh:

.  /opt/sqlanywhere11/bin32/sa_config.sh

Under C-shell and its derivatives, the command is source. For example, if SQL Anywhere is installed in /opt/sqlanywhere11, the following statement sources sa_config.csh:

source  /opt/sqlanywhere11/bin32/sa_config.csh