如何使用 ODBC 连接到 64 位 SQL Server?
我最近在我的 Windows 7 Ultimate x64 家用计算机上安装了 SQL Server 2008 Express。我也有 IIS 7.5 和 PHP 5.3,我试图通过 ADODB 连接到 SQL,但一直收到这个错误:
[Microsoft][ODBC Driver Manager] The specified DSN contains an
architecture mismatch between the Driver and Application
在互联网上进行了少量挖掘后,我认为这是因为 SQL Server ODBC 驱动程序适用于 32 位操作系统,而我的是 64 位操作系统。首先,我是否正确?这就是我遇到麻烦的原因吗?其次,如果是这样,我该如何解决这个问题?是否有适用于 64 位操作系统的更新的 ODBC 驱动程序?我看了看,但没找到任何...
I recently installed SQL Server 2008 Express on my Windows 7 Ultimate x64 home machine. I also have IIS 7.5 with PHP 5.3, and I was trying to connect to SQL via ADODB, but kept getting this error:
[Microsoft][ODBC Driver Manager] The specified DSN contains an
architecture mismatch between the Driver and Application
After doing a small amount of digging on the internet, I think this is because the SQL Server ODBC driver is meant for 32-bit operating systems, and mine's 64. First of all, am I correct? Is this the reason I'm running into trouble? Secondly, if so, how do I fix this? Are there any updated ODBC drivers that work with 64-bit operating systems? I looked but was unable to find any...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
你是对的,它与位有关。
希望这有帮助:
--来自 MSDN --
You're right in that it has to do with the bits.
Hope this helps:
--From MSDN --
我在尝试使用 Pervasive ODBC 客户端接口将 64 位 SQL 2012 服务器链接到“Sage Timberline”时遇到了同样的问题。
我可以设置 32 位 DSN,但在尝试使用 32 位 DSN 创建链接服务器时,SQL Server 不断给出“体系结构不匹配”错误。
I've been having the same problem trying to link a 64 bit SQL 2012 server to 'Sage Timberline' using Pervasive ODBC Client Interface.
I can set up the 32 bit DSN, but SQL Server keeps giving me the "architecture mismatch" error when trying to create a linked server using the 32 bit DSN.
我尝试使用
C:\Windows\SysWOW64\odbcad32.exe
添加驱动程序。但是当我在 MAS90 和 SQL Server 2008 R2 之间设置链接服务器时,我仍然收到体系结构不匹配错误。刚刚与 Sage 的一个人交谈,他说它不适用于 64 位版本的 Sql Server。仅当 Sql Server 版本为 32 位时,链接服务器才能与 MAS90 配合使用。I tried the
C:\Windows\SysWOW64\odbcad32.exe
to add the driver. But when I set up a linked server between MAS90 and SQL Server 2008 R2 I still get the architecture mismatch error. Just spoke to a guy from Sage and he says it won't work with 64-bit edition of Sql Server. The linked server works with MAS90 only if the edition of Sql Server is 32-bit.我打赌您正在使用用户 DSN。
根据您的观点,64 位 Windows 环境中存在“功能”或“错误” -
32 位用户 DSN 会显示在 64 位管理员中,并且当 64 位客户端应用程序要求提供所有可用的 DSN 时DSN - 即使 64 位客户端应用程序和管理员不能使用 32 位 DSN。
当 32 位客户端应用程序请求所有可用的 DSN 时,64 位用户 DSN 会显示在 32 位管理员中 - 即使 32 位客户端应用程序无法使用 64 位 DSN位客户端应用程序和管理员。
只要 DSN 和尝试使用它的客户端之间存在位数不匹配,就会出现您所描述的错误消息。
Microsoft 的建议是使用 _32 或 _64 命名您的用户 DSN,具体取决于它们所基于的驱动程序的位数……或者坚持使用系统 DSN。
有 32 位和 64 位解决方案可满足您所需的连接。您的客户端应用程序的位数 - IIS 和 IIS在这种情况下,PHP 决定了您需要的解决方案的位数。
I'm betting you are working with User DSNs.
Depending on your perspective, there's a "feature" or "bug" in the 64-bit Windows environment --
32-bit User DSNs show up in the 64-bit Administrator and when 64-bit client applications ask for all available DSNs -- even though the 32-bit DSNs cannot be used by the 64-bit client app and Adminstrator.
64-bit User DSNs show up in the 32-bit Administrator and when 32-bit client applications ask for all available DSNs -- even though the 64-bit DSNs cannot be used by the 32-bit client app and Adminstrator.
The error message you describe comes up anytime there's such a bitness mismatch between the DSN and the client trying to work with it.
Microsoft's recommendation is to name your User DSNs with _32 or _64, depending on the bitness of the driver on which they're based ... or stick with System DSNs.
There are 32-bit and 64-bit solutions for the connection you want. The bitness of your client application(s) -- IIS & PHP, in this case -- dictate the bitness of the solution you require.
如果 64 位操作系统上的 32 位应用程序(您安装在 [program files (X86)] 下的应用程序,请使用以下命令
C:\Windows\SysWOW64\odbcad32.exe
否则 64 位应用程序和 64 位操作系统使用以下内容
C:\Windows\System32\odbcad32.exe
否则你会收到类似“架构不匹配”的错误
希望这会拯救某人的一天:)
if 32 bit application on 64 bit operating system (the application you are installed under [program files (X86)] use the following
C:\Windows\SysWOW64\odbcad32.exe
otherwise 64 bit application and 64 bit operating system use the following
C:\Windows\System32\odbcad32.exe
otherwise you will get a error like "Architectural mismatch"
Hope this will save someone's day :)
这对我有用:
更新的解决方案,确保 IIS 应用程序未在 x64 Windows 上设置为 32 位。更多信息:
http://forum.gpsgate.com/topic.asp?TOPIC_ID=13711
来自:
http://forum.gpsgate.com/topic.asp?TOPIC_ID=13622
This worked for me:
Updated solution, make sure the IIS application is NOT set to 32-bit on x64 Windows. More info:
http://forum.gpsgate.com/topic.asp?TOPIC_ID=13711
from:
http://forum.gpsgate.com/topic.asp?TOPIC_ID=13622