Error handling
- All errors appear as relational database errors reported to the
application through the SQLSTATE and SQLCODE fields of the SQL communications
area (SQLCA). The SQLCA is defined in the IBM SQL Reference Version 1. SQLSTATE codes
are consistent across all SAA platforms and provide a consistently
portable interface. Note: The SQLCODE field is also reported. The SQLCODE provides more specific information and is better used for debugging problems in applications.
- All errors are reported back to the application program, except those for which the path back to the application has been destroyed by main memory corruption.
- If an application issues a SERRC with exit or if the application takes an error causing the ECB to exit, an implied ROLLBACK is issued to the remote AS if a unit of work was in progress.1 All changes made since the last SQL COMMIT command are backed out.
- If an application issues an EXITC with a unit of work in progress,
an implied COMMIT is issued for this application. Any changes made
to the database are now permanent, and other users can view them.
If for some reason the implied COMMIT fails, an implied ROLLBACK
is attempted to back out all the changes made since the last successful
SQL COMMIT command, if one was issued. The implied COMMIT feature
must be used carefully.
For example, if an application issues an SQL INSERT command and then exits without explicitly issuing an SQL COMMIT command, an implied COMMIT will be issued. z/TPF then issues a dump. If the implied COMMIT fails for any reason, an implied ROLLBACK is issued, and the SQL INSERT command into the table is backed out. Because the application has already exited, there is no way to report that the SQL INSERT command was backed out. This can cause the loss of data integrity. A case where the implied COMMIT could be used is when you are querying data. Because no tables are updated, if the SQL COMMIT command fails, it may not be important to the application.
See z/TPF Messages (Online, SQLCODEs, and errno Values) for information about specific SQLCODEs.