Table of Contents
If you stumbled upon this issue, chances are you're (re)installing an old software client on a new-or-newly-updated Windows 7 64-bit system. That program - often an archive/administrative/management service client or a similar home-made piece of software - uses a persistent ODBC connection to a local or remote DB via an ODBC DSN interface defined at user or system level using the Windows ODBC Administrator tool.
The aforemetioned client can't find the ODBC Data Source entry, therefore showing an error pop-up containing the following:
ODBC Call Failed - Error 3151
Or, depending on the ODBC driver installed:
ODBC Connection Failed - Error 3146
First thing we need to do is to check if the latest version of the Windows ODBC is properly installed and if a proper Data Source pointing to the DB we need to connect has been set: you can check both of these by opening the Windows Control Panel and navigate through Administrative Tools -> ODBC Data Source Administrator. If there's something missing there, fix that and check again, otherwise keep reading.
This specific issue is mostly related to how Windows 7 and above handles ODBC connections. Starting from Win7 the OS contains two different ODBC Data Source Administration tool executables: the 32-bit one and the 64-bit one. You can find them in the following folders, as explained in a note of this official KB article:
ODBC Administrator (32-bit)
ODBC Administrator (64-bit)
Which one should we use? It obviously depends on the Data Source we need to set-up. If your client supports a 64-bit connection driver you will go with the x64 version, otherwise you need to use the 32-bit one. If you're experiencing the Error 3151 problem and your ODBC connection works, chances are you're doing the right thing while using the wrong tool, i/e the 64-bit ODBC Administrator instead of the 32-bit one.
Needless to say, the problem can be fixed by launching the proper ODBC Administrator tool, which - if you're here - often is the 32-bit one.
The fact that the latest versions of Windows are shipping two different executables having an identical filename to handle ODBC connections isn't ideal and can obviously lure the users and administrators in doing configuration errors. Microsoft addressed that in Windows 8 and later, where the Control Panel's Administrative Tools features two different icons to handle the two different ODBC Administrator builds:
Unfortunately, as of today Windows 7 x64 Administrative Tools panel is still featuring a single icon, pointing to the 64-bit edition of the ODBC Administrator. The choice, as mentioned in this KB article, could be related to some retro-compatibility issues. Anyway, that's the main reason why a lot of users and administrators keep stumbling upon this issue and struggle fixing that by carefully reading the KB or by Googling it up until they reach posts like this one.
In case you need more insights on this specific scenario, here's a couple useful links regarding some mostly related issues:
- ODBC Call Failed - Error 3151 [stackoverflow.com]
- ODBC Call Failed - Error 3151 [msdn.microsoft.com]
- Why is my 32bit ODBC connection not showing up in odbcad32.exe? [superuser.com]
- ODBC Administrator tool displays both 32-bit and 64-bit user DSNs [support.microsoft.com]
- Managing Data Sources [msdn.microsoft.com]
That's about it: happy connection!