How SQL Anywhere locates files

The client library and the database server need to locate files for two main purposes:

  • DLLs and initialization files are required to run SQL Anywhere. If an incorrect DLL is located, there is the possibility of version mismatch errors.

  • Some files are specified in SQL statements and need to be located at run time, such as INSTALL JAVA or LOAD TABLE.

Examples of SQL statements that use file names include the following:

  • INSTALL JAVA statement   The name of the file that holds Java classes.

  • LOAD TABLE and UNLOAD TABLE statements   The name of the file from which data should be loaded or to which the data should be unloaded.

  • CREATE DATABASE statement   A file name is needed for this statement and similar statements that can create files.

In some cases, SQL Anywhere uses a simple algorithm to locate files. In other cases, a more extensive search is performed.

Simple file searching

In many SQL statements (such as LOAD TABLE, or CREATE DATABASE), the file name is interpreted as relative to the current working directory of the database server.

Also, when a database server is started and a database file name (DatabaseFile (DBF) parameter) is supplied, the path is interpreted as relative to the current working directory.

Extensive file searching on Windows

On Windows, SQL Anywhere programs, including the database server and administration utilities, can perform a more extensive search for required files such as DLLs or shared libraries. In these cases, SQL Anywhere programs look for files in the following order:

  1. The module's directory (the directory where the program executable file or library file is located).

  2. The executable directory (the directory where the program executable file or library is located).

  3. The installation path (the SQL Anywhere installation directory, install-dir). install-dir is a single directory specified by the SQLANY11 environment variable if it is defined.

  4. No path (the current working directory).

  5. The Location registry entry.

  6. System-specific directories. This includes directories where common operating system files are held, such as the Windows directory and the Windows\system32 directory on Windows operating systems.

  7. The PATH directories. Directories in the system path and the user's path are searched.

Note

On Windows, SQL Anywhere searches the following paths relative to each location in the preceding list:

  1. .

  2. ..

  3. .\bin32 and ..\bin32 (32-bit programs only)

  4. .\bin64 and ..\bin64 (64-bit programs only)

  5. .\java (for Java-related files)

  6. ..\java (for Java-related files)

  7. .\scripts (for SQL script files)

  8. ..\scripts (for SQL script files)

Extensive file searching on Windows Mobile

On Windows Mobile, SQL Anywhere programs, including the database server and administration utilities, can perform a more extensive search for required files such as DLLs or shared libraries. In these cases, SQL Anywhere programs look for files in the following order:

  1. The module's directory (the directory where the program executable file or library file is located).

  2. The executable directory (the directory where the program executable file or library is located).

  3. No path (the current working directory).

  4. The Location registry entry.

  5. System-specific directories. This includes directories where common operating system files are held, such as Windows.

Note

On Windows Mobile, SQL Anywhere searches the following paths relative to each location in the preceding list:

  1. .

  2. ..

  3. .\bin32

  4. ..\bin32

  5. .\java (for Java-related files)

  6. ..\java (for Java-related files)

  7. .\scripts (for SQL script files)

  8. ..\scripts (for SQL script files)

Extensive file searching on Unix

On Unix, SQL Anywhere programs, including the database server and administration utilities, can perform a more extensive search for required files such as DLLs or shared libraries. In these cases, SQL Anywhere programs look for files in the following order:

  1. The executable path (if it can be determined).

  2. The installation path (the SQL Anywhere installation directory, install-dir). install-dir is a single directory specified by the SQLANY11 environment variable if it is defined.

  3. No path (the current working directory).

  4. The PATH environment variable.

  5. The LIBPATH environment variable:

    • LD_LIBRARY_PATH on Linux and Solaris
    • LD_LIBRARY_PATH and SHLIB_PATH on HP-UX
    • LIBPATH on AIX
    • DYLD_LIBRARY_PATH on Mac OS X
Note

On Unix, SQL Anywhere searches the following paths relative to each location in the preceding list:

  1. .

  2. ..

  3. ./bin32 and ../bin32 (32-bit programs only)

  4. ./bin64 and ../bin64 (64-bit programs only)

  5. ./lib32 and ../lib32 (library files for 32-bit programs only)

  6. ./lib64 and ../lib64 (library files for 64-bit programs only)

  7. ./java (for Java-related files)

  8. ../java (for Java-related files)

  9. ./scripts (for SQL script files)

  10. ../scripts (for SQL script files)

  11. ./res (for .res files)

  12. ../res (for .res files)

  13. ./tix (for .tix files)

  14. ../tix (for .tix files)