How does the ODBC-ODBC Bridge locate ODBC data sources?

On Windows, the Easysoft ODBC-ODBC Bridge client uses the {Get|Set}PrivateProfileString interface to save and retrieve ODBC data source attributes. Use the ODBC Data Source Administrator to set up all ODBC data sources, therefore.

Linux, UNIX, and OpenVMS platforms store data sources in a text file. The ODBC-ODBC Bridge client searches for this text file in this order:

ODBCINI (environment variable)
cwd odbc.ini
cwd .odbc.ini (UNIX only, not VMS)
home odbc.ini
home .odbc.ini (UNIX only, not VMS)
/etc/odbc.ini (SYS$ROOT:odbc.ini for VMS) - system data sources only
wherever unixODBC stores data sources

where cwd is the current working directory and home is the current user's home directory (defined by the HOME environment variable then the /etc/passwd entry on UNIX or SYS$LOGIN on OpenVMS).

If the ODBC-ODBC Bridge client can't find the data source in these locations, it attempts to load the unixODBC libodbcinst shared object and use SQLGetPrivateProfileString). The client can still find your data sources, therefore, if you built the unixODBC Driver Manager with a non-default --sysconfdir value.

The ODBC-ODBC Bridge server doesn't need to look up data sources or data source attributes as it is acting as an application that communicates with either a Driver Manager or an ODBC driver directly. (Of course, this changes when you are running the ODBC-ODBC Bridge server on non-Windows machines.)

If you're using Apache and PHP, and you built PHP against ODBC-ODBC Bridge, we recommend you use /etc/odbc.ini because:

  1. The file location is outside your htdocs directory and is therefore more secure.
  2. It avoids this issue: Why can't Apache and PHP find my odbc.ini file? Why do I get the error "Datasource not found and no default driver?.