Obtaining the SQL Error

If a problem is occurring inside DB2 code, you will generally receive an SQL Error or SQL Warning when you perform an operation through a DB2 programming interface. SQL Errors and Warnings have two types of return codes. An SQLCode is returned, which is a DB2-specific code with DB2-specific details about the nature of the problem. An industry standard SQL State also gives a more general description of the error. We recommend always collecting the SQL Code for the error. You can then use the Messages Reference online book or the CLP to get details about the error, and corrective action. For example, let's say your application is receiving an SQL Code SQL1032. You can find out what this error means using the following command from the CLP:

? SQL1032

The description returned advises that the DB2 server is not active, and that the database manager must be started. You can then take corrective action by restarting the DB2 server with the db2start command and determining whether someone stopped the server, or whether the DB2 server instance crashed.

The DB2 CLI driver also has error codes that are returned, which can be looked up in the Messages Reference online book. Sometimes more serious errors can occur, such as Access Violations (Windows) or Segmentation Faults (UNIX). DB2 Service can help investigate these types of errors if the fault occurs within a DB2 library.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.17.127