Easysoft ODBC-ODBC Bridge

How does the ODBC-ODBC Bridge locate DSNs?

Last Reviewed:
28th October 2008

On Windows, the Easysoft ODBC-ODBC Bridge client uses the {Get|Set}PrivateProfileString interface to save and retrieve DSN attributes. Therefore, all data sources should be set up with the ODBC Data Source Administrator.

On non-Windows platforms, the data sources are stored in a text file. The ODBC-ODBC Bridge client searches for this text file using the following 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 DSNs only
wherever unixODBC stores DSNs

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

If the ODBC-ODBC Bridge client cannot find the DSN in the fixed locations, it will attempt to load the unixODBC libodbcinst shared object and use SQLGetPrivateProfileString(). In this way, if you built unixODBC yourself with a different --sysconfdir, ODBC-ODBC Bridge can still find your DSNs.

The ODBC-ODBC Bridge server has no need to lookup DSNs or DSN attributes as it is acting as an application talking to 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 are running Apache/PHP built with the ODBC-ODBC Bridge, Easysoft recommend you use /etc/odbc.ini because:

  1. This is more secure as it is out of your htdocs directory.
  2. It avoids possible problems when starting Apache in a directory other than where your odbc.ini file is located.

    See Apache/PHP can't to find my odbc.ini file or Datasource not found and no default driver error.

Applies To

Knowledge Base Feedback

* Did this content help you?
* Please select one option based on your first choice:

(* Required Fields)