IBM GC09-2830-00 manual To access the DB2 database from ODBC

Models: GC09-2830-00

1 196
Download 196 pages 29.94 Kb
Page 134
Image 134

The following general steps are required on the client system to give DB2 CLI and ODBC applications access to DB2 databases. These instructions assume that you have successfully connected to DB2 using a valid user ID and password. Depending on the platform many of these steps are automatic. For complete details, see the section that deals speci®cally with your platform.

Step 1. Use the Client Con®guration Assistant (CCA) to add the database (if you have separate client and server machines) so that its instances and databases can be made known to the Control Center, then add the instances and databases for that system. (Your local system is represented by Local icon.) If you do not have access to this program you can use the catalog command in the command line processor.

Step 2. On all platforms other than OS/2 the DB2 CLI/ODBC driver is an optional component during the DB2 client install. Be sure it is selected at that point. On OS/2 you must use the Install ODBC Driver icon to install both the DB2 CLI/ODBC driver and the ODBC driver manager.

Step 3. To access the DB2 database from ODBC:

a.The ODBC Driver Manager (From Microsoft or other vendor) must already be installed (this is done by default during the installation of DB2 only on 32-bit Windows systems).

b.The DB2 databases must be registered as ODBC data sources. The ODBC driver manager does not read the DB2 catalog information; instead it references its own list of data sources.

c.If a DB2 table does not have a unique index then many ODBC applications will open it as read-only. A unique index should be created for each DB2 table that is to be updated by an ODBC application. Refer to the CREATE INDEX statement in the SQL Reference. Using the Control Center you would alter the settings of the table, then select the Primary Key tab and move one or more columns from the available columns list over to the primary key columns list. Any column you select as part of the primary key must be de®ned as NOT NULL.

Step 4. If necessary, you can set various CLI/ODBC Con®guration Keywords to modify the behavior of DB2 CLI/ODBC and the applications using it.

If you followed the above steps to install ODBC support, and added DB2 databases as ODBC data sources, your ODBC applications will now be able to access them.

122Quick Beginnings

Page 134
Image 134
IBM GC09-2830-00 manual To access the DB2 database from ODBC