Using Environment Variables
Go Up to Programming with the InterBase API
InterBase client applications can use four environment variables to establish program parameters. These variables must be set so that they are available to the application when it is running. For example, setting these variables within a DOS window after Microsoft Windows has been started does not affect any Windows programs, but does affect DOS applications in that window.
The following table summarizes these variables and their uses:
Variable | Purpose | Example |
---|---|---|
|
Specifies a user name for the PC client application. |
|
|
Specifies a case-sensitive password for the PC client application. |
|
|
If one installsInterBase to a non-default directory, setting the INTERBASE environment variable helps the client application contact the correct server instance running from the same |
On Windows set the following in your system environment: On UNIX set the following in your session environment. Default is either /usr/interbase/ or /opt/interbase/ depending on the UNIX system being used.
|
|
Can be set to the name of the InterBase instance that you want to communicate with by default. If this environment variable is not set, the client applications are expected to provide the instance name of the server to connect to in the database URL syntax. The |
If
|
The ISC_USER
and ISC_PASSWORD
environment variables are used together to establish a valid user name and password combination to pass to the remote InterBase database server.
Do not use the
ISC_PASSWORD
environment variable when security is a concern. Anyone with access to a client where an ISC_PASSWORD
environment variable is defined in a file such as autoexec.bat
can easily view the password.Setting a Default Database Directory
To connect automatically to a default database directory on a remote server, create the ISC_DATABASE
environment variable and set it to the full path specification for the desired database directory, including host and path names.
Host name specification depends upon the server’s operating system and network protocol. The host syntax in the previous example is for a generic UNIX server. For other servers and operating systems, see that system’s reference manuals.
Setting a User Name and Password
To set up a default user name and password for use on a PC client, create two environment variables, ISC_USER
, and ISC_PASSWORD
.
Even if ISC_USER
and ISC_PASSWORD
are set, a different user name and password may be specified in a DPB used as an argument to isc_attach_database()
. A user name or password specified in a database parameter buffer overrides the OS environment variables.
Using environment variables in this manner is not secure, and therefore not recommended.