How to get a ODBC 32-bit DB2 driver to Run in VS 2022

Jason P 0 Reputation points
2024-04-17T19:14:40.3+00:00

I am running VS 2022 and have a 32-bit ODBC DB2 Driver setup on my local environment. When I try to debug through my code and it tries to connect to the ODBC connection I am getting the following error:

ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application

How to I get VS2022 to debug successfully using the 32-bit DB2 ODBC driver?

I have tried to also change the Project Build properties to x86 but that started to cause separate compilation error so I changed it back to Any CPU. Is there a different configuration in VS that can be done to set the version of the driver I was to use so I no longer receive this error?

Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
941 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 25,706 Reputation points Microsoft Vendor
    2024-04-18T03:14:04.1633333+00:00

    Hi @Jason P, 

    Welcome to Microsoft Q&A! 

    What is your application? 

    The error occurs when you connect to a 32-bit odbc driver on a 64-bit system.

    You need to use the 32-bit odbcad32.exe (c:\windows\sysWOW64\odbcad32.exe) to add or remove the DSN and configure the connection. 

    You can also refer to the similar issue

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments