Configuration Through the System Information (odbc.ini) File
To configure a data source manually, edit the odbc.ini file that corresponds to the type of data source you want to use. On macOS platforms, the iODBC driver manager places two odbc.ini files on your machine: one for storing User DSN information and another for storing System DSN information. The location of this file determines the type of DSNs defined in the file. The following directories contain the odbc.ini file for their respective DSN type:
For User DSNs: /Users/user_name/Library/ODBC/
For System DSNs: /Library/ODBC/
By default, the installer program creates a default data source entry for the driver in the User DSN odbc.ini file. To create a System DSN, you will need to manually create a data source entry for the driver in the correlating odbc.ini file. See "File Data Sources" for information on creating a File DSN.
To edit the file, navigate to the appropriate directory and open the odbc.ini file using a text editor. The content of this file is divided into three sections.
At the beginning of the file is a section named [ODBC Data Sources] containing data_source_name=installed-driver pairs, for example:
The driver uses this section to match a data source to the appropriate installed driver.
The [ODBC Data Sources] section also includes data source definitions. The default odbc.ini contains a data source definition for each driver. Each data source definition begins with a data source name in square brackets, for example, [Oracle Wire Protocol 2]. The data source definitions contain connection string attribute=value pairs with default values. You can modify these values as appropriate for your system. See "Connection Option Descriptions" for descriptions of these attributes. See "Sample odbcinst.ini File" for sample data sources.
The second section of the file is named [ODBC File DSN] and includes one keyword:
[ODBC File DSN]
DefaultDSNDir=
This keyword defines the path of the default location for file data sources (see "File Data Sources").
Note: This section is not included in the default odbc.ini file that is installed by the product installer. You must add this section manually.
The third section of the file is named [ODBC] and includes several keywords, for example:
The IANAAppCodePage keyword defines the default value that all UNIX/Linux drivers use if individual data sources have not specified a different value. See "IANAAppCodePage" and "Code Page Values" for details. The default value is 4.
The InstallDir keyword must be included in this section. The value of this keyword is the path to the installation directory under which the /lib and /locale directories are contained. The installation process automatically writes your installation directory to the default odbc.ini file.
For example, if you choose an installation location of /usr/local, then the following line is written to the [ODBC] section of the default odbc.ini:
InstallDir=/usr/local
Note: If you are using only DSN-less connections through an odbcinst.ini file and do not have an odbc.ini file, then you must provide [ODBC] section information in the [ODBC] section of the odbcinst.ini file. The drivers and Driver Manager always check first in the [ODBC] section of an odbc.ini file. If no odbc.ini file exists or if the odbc.ini file does not contain an [ODBC] section, they check for an [ODBC] section in the odbcinst.ini file. See "DSN-less Connections" for details.