Local and Generic Errors
A local error is a specific error issued by a specific server, such as Ingres or the Enterprise Access to IBM DB2 UDB product. All server-specific local errors are also mapped into generic errors, enabling applications to handle errors returned from a variety of servers in a consistent way.
For example, the Ingres DBMS returns the local error number 4702 for a timeout error, but other database management systems may return different error numbers for a timeout error. To handle errors consistently, OpenSQL maps the different local timeout error numbers to the same generic error number.
By default, Enterprise Access servers return errors as follows:
• Generic errors
– Returned to sqlcode (an SQLCA variable) as a negative value
– Returned when your application issues the INQUIRE_SQL(ERRORNO) statement
• Local errors
– Returned in sqlerrd(1), the first element of the SQLCA's sqlerrd array
– Returned when your application issues the INQUIRE_SQL(DBMSERROR) statement
To reverse this arrangement (so that local error numbers are returned to errorno and sqlcode and generic errors to dbmserror and sqlerrd(1)), use the SET_SQL(ERRORTYPE) statement. To obtain the text of error messages, use the INQUIRE_SQL(ERRORTEXT) statement or check the SQLCA variable sqlerrm.
Last modified date: 04/03/2024