SQL Errors

Execution Error Conditions

The execution environment of a Zim client-server application involves products from more than one vendor. This can introduce the potential for additional error situations. For example, if the parameters to the connect command are not specified correctly for the particular installation of the SQL server being used, then the connect command fails and returns an error code. If the initialization or execution environment requirements of a specific SAM have not been properly established, errors can be generated. The following topics address the types of error conditions that can occur and how they are handled.

The Deadlock Error Condition

Because Zim Client-Server applications are implicitly multi-user, the deadlock error condition can occur in an otherwise properly executing application. Each Server Access Module (SAM) detects the deadlock error condition from the SQL server it supports and translates the error into a Zim deadlock "$ ErrCode" value 2010. Accordingly the "ON DEADLOCK" exception handler can be used to handle deadlock conditions in a manner appropriate to the requirements of the application.

For more information, see Multiple Locking.

Errors from SQL Servers

Some SQL servers generate return codes distinguishing between error and warning conditions. If a server supports this distinction, then the "$ErrCode" reflected to the Zim Client-Server application also distinguishes between errors and warnings. Hence, the Zim "ON ERROR" and "ON WARNING" exception handlers can be used.

If the server does not support such a differentiation, then a Zim error condition is generated into "$ErrCode".

In either case, $SQLErrCode contains the actual SQL server error code and $SQLErrMsg contains the SQL server error message.

SAM Errors

SAMs have their own error codes. These error codes are in the -100000 range and are very rare. Some, however, are reported by Zim; the most likely ones are as follows:

-100012

The control file cannot be found. Ensure the SQLCPI environment variable points to the proper directory.

-100013

Ensure the SQLCPI environment variable is pointing to the correct directory.  Ensure the control file (i.e., odbc2m.cpi) contains the appropriate record.

-100023

Attempts by Zim to access the SAM have failed. Lack of memory is the likely cause.

-100037

Connect has failed. Check the CONNECT parameters.

-100047

Incompatible version numbers have been detected. Check that your SQLCPI variable is pointing to the correct directory, as it could accessing an out-of-date SAM.