To run the Error Handler sample, you must create two databases, each containing one table. The following script creates the databases that you need to run the Error Handler sample:
CREATE DB ERRORDB CONNECT TO ERRORDB BIND 'install_dir\bnd\@db2cli.lst' blocking all grant public CONNECT RESET CONNECT TO ERRORDB DROP TABLE ERRORS CREATE TABLE ERRORS (MSGID BLOB(48), TEXT CHAR(250), ERRORNUM INTEGER, ERRORDATE TIMESTAMP, FLOWNAME CHAR(32), NODENAME CHAR(32), MSGDATA BLOB(3200)) CONNECT RESET CREATE DB STAFFDB CONNECT TO STAFFDB BIND 'install_dir\bnd\@db2cli.lst' blocking all grant public CONNECT RESET CONNECT TO STAFFDB DROP TABLE STAFF CREATE TABLE STAFF (STAFFNUM CHAR(10), LASTCHANGE TIMESTAMP, FIRSTNAME CHAR(30), LASTNAME CHAR(30)) CONNECT RESET TERMINATE
The script performs the following tasks:
The instructions assume that you are using DB2 Universal Database. When you create and access the STAFFDB and ERRORDB tables, be aware of the following issues:
To create the databases:
db2start
db2 -vf errorhandlerdb2.sql
Wait for the script to finish running. If you are running the script for the first time, the following message is displayed, where DB2ADMIN is your user name and TBNAME is the name of the table:
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0204N "DB2ADMIN.TBNAME" is an undefined name. SQLSTATE=42704
Ignore these messages. The messages are displayed because the script attempts to drop any existing tables with the same name as the tables you are now creating, but if you have not run the script before, the program cannot find any such tables.
ERRORDB= IBM DB2 ODBC Database STAFFDB= IBM DB2 ODBC Database
[ERRORDB] Driver=/opt/IBM/db2/V8.1/lib/libdb2.so Description=ERRORDB DB2 ODBC Database Database=ERRORDB [STAFFDB] Driver=/opt/IBM/db2/V8.1/lib/libdb2.so Description=STAFFDB DB2 ODBC Database Database=STAFFDB
The ODBC drivers are now configured correctly.