Customizable SQL states in ODBC

Details

Detail name Value
Changelog Number 7677
Type Improvement
Status Resolved
Fix Versions Exasol 6.1.3
Resolution Date 2019-06-04

Background
Some applications expect certain SQL states in ODBC errors to react on error situations.
In Exasol ODBC by default the SQL states from the server are returned. This codes may not be ODBC standard conform.
Errors can be analyzed in ODBC using SQLGetDiagRec() or other diagnostic functions. There you can read the error message text (e.g. "Socket error"), the SQL state (e.g. "HY000") and a native error code as a number (e.g. -1).

Driver improvement
The ODBC user can now map any SQL State from the server to a string he wants by adding something like this to his ODBC connection string:

 sqlStateMappingActivate=Y;sqlStateMappings=ABC:DE,00001:00002 

In this example all SQL state codes starting with ABC will be changed to start with DEC: ABCXY->DECXY and all codes that have the value 00001 are replaced by 00002.
If only

 sqlStateMappingActivate=Y 

is specified, the default mapping scheme is used:

 08:42000,22:22003,27:23000,400:08003,420:42000,425:42S02,R00:08003 

Another change is that the native error code returned after an error, is now a different number for every different SQL state. Until now it was always -1.

Changed behavior

For ODBC errors read using SQLGetDiagRec and other diagnostic functions, the native error code returned is now a different number for every different SQL state. Until now it was always -1.