Wednesday, January 27, 2016

ODBC driver unexpectedly missing? Check your bitness

Today I debugged a crash that resulted from an alleged lack of an ODBC driver for the database product specified in a .NET OdbcConnection connection string. The exception text indicated that no driver could be found, but the ODBC driver had indeed been registered and appeared in the Registry.

The program had been compiled for the AnyCPU platform. That defaults to having "Prefer 32-bit" enabled. The problem was that the program was indeed started in a 32-bit process, and the driver was 64-bit. Since 32-bit programs can't load 64-bit DLLs, the driver couldn't be loaded, and so the connection failed.

The solution for that machine was to uncheck the "Prefer 32-bit" box so that the process created was 64-bit.

No comments:

Post a Comment