1
votes

Odbc-driver is version 2.x, but in Visual Studio, Version 3.x is used. Need to somehow force application to use Version 2.x Right now, there is an error: "The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr)." - but finds no way to tell the application to use an other version

Trying to communicate with a Honeywell System. They are not known for sharing data - but there is a ODBC-driver, written by someone about 15 years ago. When running on a Windows 2003 server, and compiled (on that same server) in Visual Studio 2005, the application works. Same application running on other server: Don't work. Application compiled (x86) on any other machine: Don't work, not on old server, not on new one.

Finds not properties or methods on the System.Data.Odbc.OdbcConnection, to set version of ODBC to use.

At the moment, you get no "error" running the application: It connects to the dsn, and user is authenticated. (Changing the username or password gives an error) - but no data is fetched.

Doing a trace for the calls to the ODBS driver gives:

DIAG [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed (0)

DIAG [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr). (0)

....

DIAG [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed (0)

DIAG [HY096] [Honeywell][ODBC Driver]Info type out of range (1043)

....

DIAG [HYC00] [Honeywell][ODBC Driver]Driver not capable (1010)

So, since there is no newer driver to use - I need my application to use ODBC 2.x - but it still uses ODBC 3.x.

1
You can set the ODBC datasource in Control Panel : Administrative Tools : ODBC Data Sourcejdweng

1 Answers

0
votes

When you tell VS C# to connect to an ODBC Data Source, it invisibly bridges to ODBC using the Microsoft ADO.NET Provider for ODBC, which wants everything to be as up-to-date as it is.

Your best bet in this situation is to switch to a different ADO.NET Provider that understands you can't always have a new ODBC driver, and will do its best to translate the newer C# ADO.NET API calls to the older ODBC API calls when necessary. My employer offers a couple of options, one being the Enterprise Edition Data Access for ODBC Data Sources, and the other being the Virtuoso Universal Server Enterprise Edition (functioning as a Virtual DBMS), both of which are available for immediate download, with a free temporary license provided for your testing and evaluation.