ODBC Initialization File Format

The ODBC initialization file is made up of the following sections:

ODBC Data Sources

Each entry in the ODBC Data Sources section lists a data source and a description of the driver it uses. Entries in this section have the following format:

data_source_name = driver_description 

The data_source_name identifies the data source to which the driver connects. You choose this name. This field is required.

The driver_description describes the driver to which the data source connects. This field is optional.

For example, to define an Agencies data source that uses the SYBASE SQL Server 10 driver, the ODBC initialization file entry would look like the following:

[ODBC Data Sources] 
Agencies=Sybase SQL Server 10 

Data Source Specification

Each data source listed in the ODBC Data Sources section has its own data source specification section. This section has the following format:

[Data_source_name] 
Driver=path_specification 
Attribute=keyword_value 

The data_source_name is the name defined in the ODBC Data Sources section of the ODBC initialization file.

The path_specification is the full path to the driver shared library.

Each Attribute and keyword_value pair specifies the value of a driver-specific keyword. Each driver has its own set of keywords. For driver-specific keywords and attributes, refer to the ODBC DriverSet Reference chapter. There can be any number of Attribute/keyword pairs included in the Data Source Specification.

For example, the data source called Agencies connects to a Sybase SQL Server 10 driver for UNIX called dmsyb13.so. The database that Agencies accesses is also called agencies and it resides on the SYBASE10 server. The data source specification entry for the Agencies data source would look like the following:

[Agencies] 
Driver=IDL_DIR/bin/bin.platform/dm/drivers/dmsyb13.so 
Server=SYBASE10 
Database=agencies 
UID=marvin 

where IDL_DIR is the root directory of the IDL distribution and platform is the platform-specific bin directory, for example solaris2.sparc.

In this example, the driver-specific keywords for the Sybase driver are Server, Database, and UID.

Default Data Source Specification

This section is optional. The Default Data Source specification contains information about the default data source. This data source is called Default and has the same format as any other data source specification section. However, the Default data source is not listed in the ODBC Data Sources section.

The following example shows a Default data source specification entry for an Oracle7 database.

[Default] 
Driver=IDL_DIR/bin/bin.platform/dm/drivers/dmor713.so 
Server=t:mickey:customers 
UID=marvin 

where IDL_DIR is the root directory of the IDL distribution and platform is the platform-specific bin directory, for example solaris2.sparc.

In this example, the driver-specific keywords for the Oracle7 driver are Server and UID. The Server keyword identifies the SQL*Net connect string for the ORACLE7 server called customers.

ODBC Options

The ODBC Options section ([ODBC]) specifies the ODBC root directory and indicates whether tracing is enabled or disabled. With tracing, all ODBC function calls made from an application can be logged to the specified trace file.

Warning
This section of the ODBC initialization file is recommended so that the Driver Manager can find the message files. The Driver Manager also uses this section to load the Cursor Library and the Connection Dialog Library. At a minimum, the [ODBC] section must contain the InstallDir keyword with the value set to the path in which the DriverSet is installed.

This section has the following format:

InstallDir=odbc_path 
Trace= 1 or 0 
TraceFile=log_path 
TraceDll=odbc_path/odbctrac.so 

The odbc_path is the full path to the ODBC root directory.

If the TRACE keyword is set to 0, tracing is disabled. If the TRACE keyword is set to 1, tracing is enabled.

The log_path is the full path to the specified trace file that is logging the ODBC function calls. If a trace file is not specified and tracing is enabled, logging information is written to the sql.log file located in your current directory.

The TraceDll keyword indicates the shared library that contains the ODBC tracking system.

[ODBC] 
InstallDir=IDL_DIR/bin/bin.platform/dm 
Trace=1 
TraceFile=IDL_DIR/bin/bin.platform/dm/drivers/trace.log 
TraceDll=IDL_DIR/bin/bin.platform/dm/lib/odbctrac.so 

where IDL_DIR is the root directory of the IDL distribution and platform is the platform-specific bin directory, for example solaris2.sparc.