However, the value for SQLCODE is IBM defined. To achieve the highest 
portability of applications, you should only build dependencies on a subset of 
DB2 SQLSTATEs that are defined by ODBC Version 3 and ISO SQL/CLI 
specifications. Whenever you build your exception handling on IBM supplied 
SQLSTATEs or SQLCODEs, the dependencies should be carefully documented. 
The specifications can be found using the search words ISO/IEC and standards 
9075 1, 9075 2, and 9075 3 for SQL Foundation.
SQLSTATE is a five character string conforming with the ANSI SQL92 standard. 
The first two characters are known as the SQLSTATE class code. For example: 
  00
 means successful completion
  01
 is a warning
  HY
 is generated by the DB2 CLI (call level interface) or ODBC driver
  IM
 is generated by the ODBC driver manager
If, for example, your application would signal SQLSTATE 23000, the DB2 
description reports an 
integrity constraint violation , 
which is quite similar to 
MySQL's rudimentary description ER NON UNIQ ERROR or ER DUP KEY. 
Hence, condition handling for both database management systems could almost 
execute the same code.
Error returns in MySQL
Although it was necessary to limit the scope of this document to MySQL Version 
4.0, fairness requires us to mention that Version 4.1. of MySQL provides 
exception handling using SQLSTATE. It will only appear for Version 4.1 or later, 
and was added for compatibility with X/Open/ANSI/ODBC behavior in an attempt 
to attract standard compliant applications, and encourage existing MySQL 
applications to become more standard compliant. 
The definition for SQLSTATE can be found in the MySQL source code file 
include/sql_state.h
.
SQLSTATE for DB2 CLI
Follow these guidelines for using SQLSTATEs within your CLI application:
Always check the function return code before calling 
SQLGetDiagRec()
 to 
determine if diagnostic information is available. Please refer to the IBM DB2 
UDB manual 
Call Level Interface Guide and Reference, Volume 2, 
SC09 4850 for more information on this API.
Use the SQLSTATEs rather than the native error code. 
To increase your application s portability, only build dependencies on the 
subset of DB2 CLI SQLSTATEs that are defined by the ODBC version 3 and 
ISO SQL/CLI specifications, and return the additional ones as information 
only.
214 
MySQL to DB2 UDB Conversion Guide






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

san diego web hosting

 

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