Skip to content

Latest commit

 

History

History
36 lines (30 loc) · 1.79 KB

File metadata and controls

36 lines (30 loc) · 1.79 KB
title File-Based Driver Diagnostic Example
description File-Based Driver Diagnostic Example
author David-Engel
ms.author davidengel
ms.date 01/19/2017
ms.service sql
ms.subservice connectivity
ms.topic conceptual
helpviewer_keywords
file-based driver diagnostic [ODBC]
diagnostic information [ODBC], examples
error messages [ODBC], diagnostic messages

File-Based Driver Diagnostic Example

A file-based driver acts both as an ODBC driver and as a data source. It can therefore generate errors and warnings both as a component in an ODBC connection and as a data source. Because it also is the component that interfaces with the Driver Manager, it formats and returns arguments for SQLGetDiagRec.

For example, if a Microsoft driver for dBASE could not allocate sufficient memory, it might return the following values from SQLGetDiagRec:

SQLSTATE:         "HY001"  
Native Error:      42052  
Diagnostic Msg:   "[Microsoft][ODBC dBASE Driver]Unable to allocate sufficient memory."  

Because this error was not related to the data source, the driver only added prefixes to the diagnostic message for the vendor ([Microsoft]) and the driver ([ODBC dBASE Driver]).

If the driver could not find the file Employee.dbf, it might return the following values from SQLGetDiagRec:

SQLSTATE:         "42S02"  
Native Error:      -1305  
Diagnostic Msg:   "[Microsoft][ODBC dBASE Driver][dBASE]No such table or object"  

Because this error was related to the data source, the driver added the file format of the data source ([dBASE]) as a prefix to the diagnostic message. Because the driver was also the component that interfaced with the data source, it added prefixes for the vendor ([Microsoft]) and the driver ([ODBC dBASE Driver]).