DSN and ODBC.INI FAQ
Where are my Data Source Definitions (DSNs) stored?
Under windows the .ini files are stored in the registry. With UNIX, they are stored as files in
a couple of different areas. The exact location is installation dependant and the defaults
used vary by distribution and manager.
Typically, the users DSNs are stored in the users home directory (~/) in a file named (.odbc.ini)
or (odbc.ini).
The System DSNs are stored in a file named (odbc.ini) and may be found in /usr/local/etc or /etc.
The system file may be located in another directory if directed upon installation of the Driver
Manager.
What is a ODBC Manager?
The Manager provides a way for less OS dependant applications to use ODBC drivers. They also
provide mechanisms to reduce driver dependencies.
Most types of UNIX do not install a default ODBC Manager. The two that are commonly used are
unixODBC and
iODBC. Your UNIX
distribution may pre-install one of these (OSX does this with iODBC), or it may provide it as
an optional package for installation.
- ODBCINI - The path to an odbc.ini (.odbc.ini) file.
- ODBCSYSINI - The directory in which the odbcinst.ini and
"system" odbc.ini file are stored.
- ODBCINSTQ - QT GUI path for X Windows.
- ODBCSEARCH - Search order for User and System DSNs.
One of ODBC_SYSTEM_DSN, ODBC_USER_DSN, or ODBC_BOTH_DSN.
What is stored in a DSN?
The information needed by the driver to access the data. The information that contains password
in formation is encoded to improve security. Most of the fields are not encoded and may be edited
with a text editor as needed.
How do I add a new DSN?
Due to the encoded password information, the ODBC Manager provided odbcinst application cannot be
used to add DSNs used by Minisoft drivers. You should use the provided config3kodbc.exe application
to initially create the DSN.
Who gets to use which DSN?
The files read by the driver are controlled by the environment variables ODBCINI and ODBCSYSINI.
They may be set using the instructions found in
(Setting Environment Variables).
ODBCINI provides the fully qualified file name of the user DSN storage. (default ~/.odbc.ini)
ODBCSYSINI provides the directory of the odbc.ini used to store system DSNs.
(default /usr/local/etc) The same variable controls the directory used to store the odbcinst.ini
file that contains the list of installed drivers.
Sample adding the driver to the odbcinst.ini file.
# setenv ODBCINST.INI /usr/local/etc/odbcinst.ini
# odbcinst -i -d -n 3kodbc -f /opt/minisoft/drvinst.ini
odbcinst: Driver installed. Usage count increased to 1. Target directory is /usr/local/etc
# odbcinst -q -d
[3kodbc]
Sample adding a system DSN using unixODBC directories and
export.
$ export ODBCSYSINI=/usr/local/etc
$ export ODBCINI=/usr/local/etc/odbc.ini
$ /opt/minisoft/config3kodbc.exe -i -s -f /opt/minisoft/test.ini
Install requested.
Using system DSN file (/usr/local/etc)
Data Source Name="DSN=MSCARD2262", size=257
DoInstall return True
$ odbcinst -q -s
[MSCARD2262]
|