.odbc.ini(4)
THE .odbc.ini FILE
This document describes the .odbc.ini file for the INTERSOLV DataDirect ODBC drivers. It contains the following sections:
Introduction
Configuring Data Sources
Translating Data
An Example of ODBC.INI
Connecting to a Data Source
INTRODUCTION
The .odbc.ini file is a plain text file that stores ODBC configuration and connection information. It normally resides in the user’s $HOME directory. This file is maintained manually. The .odbc.ini file defines data source entries as described in the "Configuring Data Sources" section.
UNIX support of the database drivers also allows the use of a centralized ODBC.INI file that a system administrator can control. This is accomplished by setting the environment variable ODBC_INI to point to the fully qualified name of the centralized file. For example, in the C shell you could set this variable as follows:
setenv ODBC_INI /opt/${REV}/odbc/system_odbc.ini
In the Bourne or Korn shell, you would set it this way:
ODBC_INI=/opt/${REV}/odbc/system_odbc.ini;export ODBC_INI
If a user has a private copy of .odbc.ini in his or her $HOME directory, it is used instead of the centralized version.
CONFIGURING DATA SOURCES
For every driver you wish to use, at least one data source must be defined. Use any plain text editor (vi, for example) to edit the .odbc.ini file and define the data sources you need there.
The .odbc.ini file has the following structure:
[ODBC Data Sources] ;Lists data sources available to ODBC.
ds_name1=description ;Lists each data
source name followed by
; a description.
ds_name2=description
...
[ds_name1] ;Defines the actual ODBC Driver source;
; for example, Text.
Driver=path/dll ;Defines the actual path to the driver
; DLL.
...
[ds_name2]
Driver=path/dll
...
In this description, comment lines begin with a semicolon (;).
The [ODBC Data Sources] section is mandatory. It provides the Driver Manager with a list of data sources that are supported for your connection requests. You can change the names in this list, but each entry must match its corresponding [ds_name] section in this file.
The [ds_name] sections contain a Driver= specification that points to the location of the installed driver, as well as a Description= specification that describes the driver. If you change the location of a driver, you must change the Driver= specification to match the new location, or you can use just the name of the driver and the driver manager will attempt to locate the driver based on information obtained from your environment.
You might need to assign other entries depending on the driver that is being configured. In the man page for each driver, see the "ATTRIBUTES" section for a list of entries supported for data sources. Note that in the .odbc.ini file, you are required to use the long name of these attributes. Setting these attributes in .odbc.ini files changes their default settings.
You can override the defaults by setting these attributes in the connection string. For more information, see the "CONNECTING TO A DATA SOURCE" section in this man page and in the man page for each driver.
TRANSLATING DATA
To perform a translation of your data from one character set to another, use the TranslationDLL keyword and optionally, the TranslationOption keyword, in the appropriate data source section of the .odbc.ini file.
Set the TranslationDLL keyword to the full path of translation DLL.
Set the TranslationOption to the ASCII representation of the 32-bit integer translation option.
AN EXAMPLE OF ODBC.INI
Here is an example of an .odbc.ini file:
;---------------------------------------------------
; ODBC.INI - INTERSOLV ODBC Driver Manager INI File
;---------------------------------------------------
[ODBC Data Sources]
qedbf=dBASE
qedb2=DB2
qeinf5=INFORMIX 5
qeinf7=INFORMIX 7
qeing4=INGRES 6.4/04
qeora=Oracle
qeor7=Oracle 7
qess=SQL Server
qesyb=Sybase System 10
qetxt=Text
[qedbf]
Driver=qedbf06.so
Description=INTERSOLV dBASE driver
[qedb2]
Driver=qedb207.so
Description=INTERSOLV DB2/2 driver
[qeinf5]
Driver=qeinf507.so
Description=INTERSOLV INFORMIX 5 driver
Database=payroll
[qeinf7]
Driver=qeinf707.so
Description=INTERSOLV INFORMIX 7 driver
[qeing4]
Driver=qeing407.so
Description=INTERSOLV INGRES 6.4/04 driver
ServerName=alice
LogonID=test
[qeora]
Driver=qeora07.so
Description=INTERSOLV Oracle driver
ServerName=t:magna:V7
LogonID=test
[qeor7]
Driver=qeor707.so
Description=INTERSOLV Oracle driver
ServerName=t:magna:V7
LogonID=test
[qess]
Driver=qess07.so
Description=INTERSOLV SQL Server driver
ServerName=alice
LogonID=test
[qesyb]
Driver=qesyb07.so
Description=INTERSOLV System 10 driver
ServerName=alice
LogonID=test
[qetxt]
Driver=qetxt07.so
Description=INTERSOLV Text driver
CONNECTING TO A DATA SOURCE
If your application requires a connection string to connect to a data source, you must specify the data source name that tells the driver which section of the .odbc.ini file to use for the default connection information. Optionally, you may specify attribute/value pairs in the connection string to override the default values stored in the .odbc.ini file. For more information, see the "CONNECTING TO A DATA SOURCE" section in the man page for each driver.
INTERSOLV, Inc. — Last change: 30 June 1995