/etc/unixODBC/odbcinst.ini
, in which you need to add the following:
[IBM DB2 ODBC DRIVER]
Driver=/home//sqllib/lib/db2.o
/home//.odbc.ini
, in which you need to configure the data
source; for setting up a data source you need to add the following:
In [ODBC Data Source] stanza add
itsodb2= IBM DB2 ODBC DRIVER
Add [itsodb2] stanza with
Driver=/home//sqllib/lib/db2.o
Description=itsodb2 DB2 ODBC Database
in [ODBC] stanza add
InstallDir=/home/sqllib/odbclib
MyODBC
As shown in
Figure 7 6, you do not need to use MyODBC now, instead you
will use DB2 ODBC Driver.
MySQL Server
The MySQL database server is replaced by the DB2 UDB server; this is
discussed in detail in previous chapters.
You may optionally configure DB2 ODBC Driver to modify the behavior of the
DB2 ODBC Driver. This can be done by changing the
db2cli.ini
file.
7.2.6 Condition handling in DB2
Condition handling is one of the least sparkling topics in the application
development arena. Foreseeing and handling exceptions in the application is
paramount for a robust, industrial strength programming style. This section
attempts an introduction to various ways to handle conditions in DB2.
Error checking with SQLCODE and SQLSTATE
Each time an SQL statement is executed two values are returned by the DB2
engine and placed in the SQL communication area (SQLCA): SQLCODE and
SQLSTATE.
Within your application program you can retrieve these values to determine the
state of the previously executed SQL statement. They are identifiers to get more
detailed information about the condition of the statement.
SQLCODE is the variable conventionally used for error handling in applications
coded against the DB2 family. Therefore, SQLCODE is probably of the finest
granularity when it comes to DB2 exception handling.
Chapter 7. Application porting
213
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved