The platform specific details on how to give DB2 CLI and ODBC applications access to DB2 are divided into the following categories:
Before DB2 CLI and ODBC applications can successfully access a DB2 database from a Windows 3.1, Windows 95, or Windows NT client, perform the following steps on the client system:
For more information refer to the on-line help in the CCA (or the catalog command in the Command Reference).
To verify that they both exist on the machine:
If either the Microsoft ODBC Driver Manager or the IBM DB2 CLI/ODBC driver is not installed, then rerun the DB2 install and select the ODBC component in Windows 95 or Windows NT, or double-click on the Install ODBC Driver icon in the DB2 program group in Windows 3.1.
See the
CATALOG [ user | system ] ODBC DATA SOURCEcommand in the Command Reference for more information.
For information on manually editing this file (db2cli.ini), see "Configuring db2cli.ini".
Although not directly related to DB2, some users have experienced problems when running 16-bit ODBC applications on Windows 95 or Windows NT.
Both 16- and 32-bit applications use the same 32-bit IBM DB2 CLI/ODBC Driver. The Microsoft ODBC Driver Manager takes care of the conversion between the 16-bit application and the 32-bit ODBC driver.
Some 16-bit applications were shipped with an old set of 16-bit Driver Manager DLLs (that is, before 1995). These DLLs do not function well in the 32-bit environment. The following symptoms may occur when running the old DLLs:
If (and only if) you are experiencing these problems you may want to update the Microsoft 16-bit ODBC Driver Manager DLLs. These files are provided with DB2 in the SQLLIB\MSODBC16 subdirectory. Use these new DLLs to replace the older versions that are located in the system subdirectory of the Windows operating system directory.
Before DB2 CLI and ODBC applications can successfully access a DB2 database from an OS/2 client, perform the following steps on the client system:
For more information see the on-line help in the CCA (or the catalog command in the Command Reference).
For information on manually editing this file (db2cli.ini), see "Configuring db2cli.ini".
Before DB2 CLI and ODBC applications can successfully access a DB2 database from a UNIX client, perform the following steps on the client system:
For more information see the catalog command in the Command Reference.
Setting up odbcinst.ini
The settings in this file impact all of the ODBC drivers on the machine.
Use an ASCII editor to update this file. It must have a stanza (section) called [IBM DB2 ODBC DRIVER], with a line starting with "Driver" indicating the full path to the DB2 ODBC driver (db2.o). For example, if the home directory of your end user is /u/thisuser/ and the sqllib directory is installed there, then the correct entry would be:
[IBM DB2 ODBC DRIVER] Driver=/u/thisuser/sqllib/lib/db2.oSee the sample file in the sqllib/odbclib subdirectory for an example.
Setting up odbc.ini
The settings in this file are associated with a particular user on the machine; different users can have different odbc.ini files.
The odbc.ini file must be copied into the end user's home directory and called .odbc.ini. Update this file, using an ASCII editor, to reflect the appropriate data source configuration information. To register a DB2 database as an ODBC data source there must be one stanza (section) for each DB2 database.
The sample odbc.ini template shows:
SAMPLE=IBM DB2 ODBC DRIVERIndicates that there is a data source called SAMPLE that used the IBM DB2 ODBC DRIVER.
[SAMPLE] Driver=/u/thisuser/sqllib/lib/db2.o Description=Sample DB2 ODBC DatabaseIndicates that the SAMPLE database is part of the DB2 instance located in the directory /u/thisuser.
InstallDir=/u/thisuser/sqllib/odbclibIndicates that /u/thisuser/sqllib/odbclib should be treated as the location where ODBC is installed.
Note: | If your application specifically installed the ODBC components (such as the
Driver Manager) elsewhere, you must update the line starting with InstallDir
under the [ODBC] stanza to reflect this new location.
For example, if ODBC has been installed in /opt/odbc, the [ODBC] stanza would look like: [ODBC] Trace=0 TraceFile=odbctrace.out InstallDir=/opt/odbc |
See the sample file in the sqllib/odbclib subdirectory for an example. You can also see "How to Configure ODBC.INI" for more detailed information.
Once the .ini files are set up you can run your ODBC application and access DB2 databases. Refer to the documentation that comes with your ODBC application for additional help and information.
There are various keywords and values that can be used to modify the behavior of DB2 CLI/ODBC and the applications using it. The keywords are associated with the database alias name, and affect all DB2 CLI/ODBC applications that access the database.
For information on manually editing this file (db2cli.ini), see "Configuring db2cli.ini". For information about the specific keywords see "Configuration Keywords".
Before DB2 CLI and ODBC applications can successfully access a DB2 database from a Macintosh client, perform the following steps on the client system:
For more information see the catalog command in the Command Reference.
The MacODBC driver manager uses the ODBC Preferences file or the ODBC Preferences PPC file to record information about the available drivers and data sources.
It is also possible to modify these files manually. Do not change any of the existing entries in the files.
[ODBC Data Sources] GLOBALDB=IBM ODBC DB2 for Macintosh SAMPLE=IBM ODBC DB2 for Macintosh [GLOBALDB] Driver=appl:ODBC$DB2DriverFunctionSet Description=My GLOBAL database [SAMPLE] Driver=appl:ODBC$DB2DriverFunctionSet Description=My SAMPLE database
[ODBC Data Sources] SAMPLE=IBM ODBC DB2 for PPC [SAMPLE] Driver=DB2ODBCDriverPPC Description=My SAMPLE database
For each data source listed in the [ODBC Data Source] section, there is a section that lists additional information about that data source. These are called the Data Source Specification sections.
Under the [ODBC DATA SOURCE] entry, add the following line:
Where database_alias is the alias of the database cataloged in the database directory (the database name used by the Command Line Processor CONNECT TO statement).
[database_alias] Driver=appl:ODBC$DB2DriverFunctionSet
[database_alias] Driver=DB2ODBCDriverPPC