SQL Database Level Errors (12289)

The SQL error handling mechanism is quite different from the DataFlex mechanism. Ideally, we would be able to project the error system on to the DataFlex system. Unfortunately, this is not possible. The identification mechanism in both systems is incompatible. DataFlex uses error numbers where SQL uses SQL State, a 5-byte character string.

We have chosen to use one number for every SQL error that is reported to the driver. This number is 12289. Database level errors will always be formatted:

12289 -- <SQL State> (<Native Error>)--<Component identifier> <Error text>

 

SQL State

SQL States are used in SQL environments to identify a certain exception condition that has occurred. SQL states are 5 character strings using only uppercase letters A – Z and the digits 0 – 9. The string is divided into two components. The first two characters are the class code; the last three are the subclass code. For more information on SQL States, see the SQL Server documentation.

NativeErr

The native error number of the SQL Server error.

Component Identifier

The component identifier is supposed to help you identify the component that causes the error. The communication to SQL Server uses a number of components, each of which can raise an error. For errors and messages that occur outside of the SQL Server data source the component identifier format is:

[Vendor identifier][Component identifier]

For errors that occur inside the SQL Server data source the component identifier format is:

[Vendor identifier][Component identifier][Data source identifier]

Error Text

Contains the text of the error or message.

Truncated Error Text

The error messages generated by SQL back ends tend to be a bit larger than is common in a traditional DataFlex environment. The object oriented error handlers within a DataFlex environment can handle these long texts without problems. Procedural programs however tend to reserve one line of 80 positions that is used for error reporting. If the error text is larger than 80 positions, it will be truncated. If the error text is truncated, use the database documentation to find the SQL State.

You can get the complete error text by calling the LastDriverError function.

Alternatively you can set the Error_Debug_Mode configuration keyword.

See Also

SQL State Table