Home | Previous Page | Next Page   Environment Variables > Environment Variables >

DBPATH

The DBPATH environment variable identifies database servers that contain databases. DBPATH can also specify a list of directories (in addition to the current directory) in which DB–Access looks for command scripts (.sql files).

The CONNECT DATABASE, START DATABASE, and DROP DATABASE statements use DBPATH to locate the database under two conditions:

The CREATE DATABASE statement does not use DBPATH.

To add a new DBPATH entry to existing entries, see Modifying an Environment-Variable Setting.

Read syntax diagramSkip visual syntax diagram                   .-: [16]--------------------------------.
                   V                                       |
>>-setenv--DBPATH----+-pathname--------------------------+-+---><
                     +-/ /--servername--/--full_pathname-+
                     '-/ /--servername-------------------'
 
full_pathname
is the full path, from root, of a directory where .sql files are stored.
pathname
is the valid relative path of a directory where .sql files are stored.
servername
is the name of an Informix database server where databases are stored. You cannot reference database files with a servername.

DBPATH can contain up to 16 entries. Each entry must be less than 128 characters. In addition, the maximum length of DBPATH depends on the hardware platform on which you set DBPATH.

When you access a database with the CONNECT, DATABASE, START DATABASE, or DROP DATABASE statement, the search for the database is done first in the directory or database server specified in the statement. If no database server is specified, the default database server that was specified by the INFORMIXSERVER environment variable is used.

If the database is not located during the initial search, and if DBPATH is set, the database servers and directories in DBPATH are searched for in the specified database. These entries are searched in the same order in which they are listed in the DBPATH setting.

Using DBPATH with DB-Access

If you use DB–Access and select the Choose option from the SQL menu without having already selected a database, you see a list of all the .sql files in the directories listed in your DBPATH. Once you select a database, the DBPATH is not used to find the .sql files. Only the .sql files in the current working directory are displayed.

Searching Local Directories

Use a pathname without a database server name to search for .sql scripts on your local computer. In the following example, the DBPATH setting causes DB–Access to search for the database files in your current directory and then in the Joachim and Sonja directories on the local computer:

setenv DBPATH /usr/joachim:/usr/sonja

As the previous example shows, if the pathname specifies a directory name but not a database server name, the directory is sought on the computer that runs the default database server that the INFORMIXSERVER specifies; see INFORMIXSERVER. For instance, with the previous example, if INFORMIXSERVER is set to quality, the DBPATH value is interpreted, as the following example shows, where the double slash precedes the database server name:

setenv DBPATH //quality/usr/joachim://quality/usr/sonja

Searching Networked Computers for Databases

If you use more than one database server, you can set DBPATH explicitly to contain the database server and directory names that you want to search for databases. For example, if INFORMIXSERVER is set to quality but you also want to search the marketing database server for /usr/joachim, set DBPATH as the following example shows:

setenv DBPATH //marketing/usr/joachim:/usr/sonja

Specifying a Servername

You can set DBPATH to contain only database server names. This feature allows you to locate only databases; you cannot use it to locate command files.

The database administrator must include each database server mentioned by DBPATH in the $INFORMIXDIR/etc/sqlhosts file. For information on communication-configuration files and dbservernames, see your IBM Informix: Administrator's Guide and the IBM Informix: Administrator's Reference.

For example, if INFORMIXSERVER is set to quality, you can search for a database first on the quality database server and then on the marketing database server by setting DBPATH, as the following example shows:

setenv DBPATH //marketing

If you use DB–Access in this example, the names of all the databases on the quality and marketing database servers are displayed with the Select option of the DATABASE menu.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]