大网数据广告活动
数据库与应用安全

ODBC tool displays both 32-bit and 64-bit

· 52CE 我爱测

This article provides workaround for the problem that occurs in the ODBC Data Source Administrator tool.

This article provides workaround for the problem that occurs in the ODBC Data Source Administrator tool.

Original product version:   SQL Server
Original KB number:   942976

Symptoms

A 64-bit version of the Microsoft Windows operating system includes the following versions of the ODBC Data Source Administrator tool (Odbcad32.exe):

  • The 32-bit version of the Odbcad32.exe file is located in the %systemdrive%\Windows\SysWoW64 folder.
  • The 64-bit version of the Odbcad32.exe file is located in the %systemdrive%\Windows\System32 folder.

The Odbcad32.exe file displays the following types of data source names (DSNs):

  • System DSNs
  • User DSNs

Symptom 1

The 32-bit version of the ODBC Administrator tool displays 32-bit system DSNs, 32-bit user DSNs, and 64-bit user DSNs. The 64-bit version of the ODBC Administrator tool displays 64-bit system DSNs, 32-bit user DSNs, and 64-bit user DSNs.

Symptom 2

The SQLDataSources function returns all versions of user DSNs, regardless of the architecture of the application. The SQLDataSources function that is called in a 32-bit application returns only system DSNs for 32-bit drivers but returns user DSNs for both 32-bit drivers and 64-bit drivers. Similarly, the SQLDataSources function that is called in a 64-bit application returns only system DSNs for 64-bit drivers but returns user DSNs for both 32-bit drivers and 64-bit drivers. Therefore, if the application makes a connection by using a user DSN that is returned from the SQLDataSources function, you may receive the following error message:

Data source name not found and no default driver specified

For example, consider the following scenario. You create a user DSN for the 32-bit driver 'Microsoft Access Driver (*.mdb)'. This driver doesn't have a corresponding 64-bit version. The SQLDataSources function that is called in a 64-bit application returns this 32-bit user DSN. However, if you make a connection through this 32-bit user DSN, you receive the error message that is mentioned earlier in this section.

Cause

The user DSNs are stored under the following registry subkey:

HKEY_CURRENT_USER\Software\ODBC\ODBC.INI

Registry redirection isn't enabled for this registry subkey. Therefore, user DSNs are visible in both the 32-bit and 64-bit versions of the ODBC Administrator tool.

Resolution

To maintain backward compatibility, no resolution for this problem is currently available.

Workaround

To work around this problem, use the appropriate version of the ODBC Administrator tool. If you build and then run an application as a 32-bit application on a 64-bit operating system, you need to use the %windir%\SysWOW64\odbcad32.exe ODBC Administrator tool to create the ODBC data source. To indicate the type of DSN, you can add '_32' to the 32-bit user DSNs and '_64' to the 64-bit user DSNs.

More information

The 64-bit ODBC Administrator tool can be invoked from Control Panel to manage user DSNs and system DSNs that are used by 64-bit processes. On a 64-bit operating system, the 32-bit ODBC Administrator tool is used for Windows on Windows 64 (WOW64) processes. You must directly invoke the 32-bit ODBC Administrator tool from the SysWoW64 folder. You can use the 32-bit ODBC Administrator tool to manage user DSNs and system DSNs that are used by WOW64 processes.

System DSNs are stored in the following registry subkey:

HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI

Registry redirection is enabled for this registry subkey. Therefore, system DSNs for 32-bit drivers and for 64-bit drivers are separated. The 64-bit ODBC Administrator tool doesn't display system DSNs that are created by the 32-bit ODBC Administrator tool. Similarly, the 32-bit ODBC Administrator tool doesn't display system DSNs that are created by the 64-bit ODBC Administrator tool. Also, the 64-bit ODBC Administrator tool doesn't display system DSNs that use 32-bit drivers. Similarly, the 32-bit ODBC Administrator tool doesn't display system DSNs that use 64-bit drivers.

User DSNs are stored in the following registry subkey:

HKEY_CURRENT_USER\Software\ODBC\ODBC.INI

Registry redirection isn't enabled for this registry subkey. Therefore, both ODBC Administrator tools display all user DSNs.

For more information about registry redirection, see Registry Redirector.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 01/17/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。