Using ODBC data sources on Unix

On Unix operating systems, ODBC data sources are held in a system information file. This file may or may not be named .odbc.ini. The following locations are searched, in order, for the system information file:

  • The ODBCINI environment variable.

  • The ODBC_INI environment variable.

  • The ODBCHOME environment variable.

  • The HOME environment variable.

  • The user's home directory (~).

  • The PATH environment variable.

Note

The ODBCINI and ODBC_INI environment variables point to the system information file (which may or may not be named .odbc.ini), while the ODBCHOME and HOME environment variables point to a path where the .odbc.ini file is located.

Both ODBCINI and ODBC_INI specify a full path, including the file name. If the system information file is located in a directory specified by ODBCINI or ODBC_INI, it does not have to be named .odbc.ini.

The following is a sample system information file:

[My Data Source]
ENG=myserver
CommLinks=tcpip(Host=hostname)
UID=DBA
PWD=sql

You can enter any connection parameter in the system information file. See Connection parameters.

Network protocol options are added as part of the CommLinks (LINKS) parameter. See Network protocol options.

Caution

Storing user IDs, encrypted or unencrypted passwords, and database keys in a data source is not recommended.

On Unix, use the dbdsn utility to create and manage ODBC data sources.

Caution

On Unix, do not add simple encryption to the system information file (named .odbc.ini by default) with the File Hiding utility (dbfhide) unless you are using only SQL Anywhere data sources. If you plan to use other data sources (for example, for MobiLink synchronization), then obfuscating the contents of the system information file may prevent other drivers from functioning properly.

See also