DB-Library Error Message Format

Troubleshooting SQL Server

Troubleshooting

DB-Library Error Message Format

DB-Library returns Microsoft® SQL Server™ errors and messages to call-back functions written by the application programmer.

The application programmer uses the dberrorhandle function to give DB-Library the address of the call-back function that handles the errors. When DB-Library determines that an error has occurred, it calls the call-back function identified by dberrorhandle. DB-Library passes the SQL Server error information into the parameters of the call-back function:

severity

Contains the severity of the error.

dberr

Contains the SQL Server error number.

dberrstr

Contains the description of the SQL Server error.

The application programmer uses the dbmsghandle function to give DB-Library the address of the call-back function that handles the messages. When DB-Library receives an informational message from SQL Server, it calls the call-back function identified by dbmsghandle.

DB-Library passes the SQL Server message information into the parameters of the call-back function:

msgno

Contains the error number identifying the message.

msgstate

Contains the SQL Server message state.

severity

Contains the severity of the error condition.

msgtext

Contains the description of the SQL Server message.

srvname

Contains the server name that generated the message.

procname

Contains the stored procedure name that generated the message.

line

Contains the line number in the stored procedure or the command batch that generated the message.

DB-Library calls the application error handler and message handler functions asynchronously as packets containing messages and errors are received from the server. This means DB-Library applications may receive errors and messages in a slightly different sequence from applications using either the Microsoft OLE DB Provider for SQL Server or the SQL Server ODBC Driver.