ODBC和udl文件在Server 2003 64 机器上问

来源:互联网 发布:戒指 知乎 编辑:程序博客网 时间:2024/05/27 21:15

1、ODBC在Server 2003 64机器出现的问题:在Server 2003 64机器上打开控制面板->找到管理工具->找到ODBC打开->在驱动程序选项中只发现了SqlServer驱动别的都么有,点击系统DSN选项->点击add后发现里面没有别的只有SqlServer的,这就是我在这连天遇到的第一个问题?这个问题到底是什么原因导致呢?这个问题也花费了我不少时间,下面我来解释一下:

这个问题是由于我忽略了一个大前提,那就是操作系统是Server 2003 64位的,只要注意到这个大前提,那么这个问题就解决了一半。64位系统跟32位系统还是有区别的,odbc和下面的要讲的udl文件都是跟系统有关的。你在控制面板上找到的odbc是32位的所以里面没有其他的数据库驱动,其实在64位系统中有他自己的odbc,它存放在\WINDOWS\SysWOW64/文件夹下。那么你在这个文件加下找到odbcad32.exe,双击打开就可以看到所有数据库驱动了。


2、32位的udl文件在Server 2003 64机器出现的问题:我在32位机子上使用的udl文件测试连接时没有问题,发在64位机子上进行测试链接是却出现连接错误,提示不能连接数据源、找不到数据源,这个问题也话费了我好长时间。其实也是问题也是出在系统的问题上。64位系统处理32位系统上的udl文件时,有自己的策略。详细下面的英文说明:

“UDL Test” on a 64 bit machine

Let’s say you’ve started playing with UDL files on your "32 bit" machine and this tiny little UDL files helped you to identify connectivity issues or you’ve easily obtained the OLE DB connection strings for your applications. So far so good. But one day, you followed the same procedure on a 64 bit machine and couldn’t see the OLE DB Providers though you’re sure that it’s been installed. There must be something wrong then ?

The reason behind for this is simple. When you double clicked on a UDL file on a 64 bit machine, it’ll enumerate only the 64 bit OLE DB Providers and most probably you’ve installed a 32 bit OLE DB Provider.

So then, there should be a way of making UDL Test using the 32 bit OLE DB Providers on a 64 bit machine.

Actually when you’ve created a UDL file on a 64 bit machine and double clicked on it,

"C:\Program Files\Common Files\System\Ole DB\oledb32.dll",OpenDSLFile C:\test.udl

command will be called through C:\windows\system32\rundll32.exe

Both binaries (oledb32.dll and rundll32.exe) used here are 64 bit and 64 bit oledb32.dll does not deal with 32 bit OLE DB Providers.

Since we already have 32 bit versions of those oledb32.dll and rundll32.exe in other folders on our 64 bit machines, we need to use them. Therefore, instead of double clicking on the UDL file, we’ll need to execute the command below from a command line or Start/Run :

C:\Windows\syswow64\rundll32.exe "C:\Program Files (x86)\Common Files\System\Ole DB\oledb32.dll",OpenDSLFile C:\test.udl

Et voila :) There you have your 32 bit OLE DB Providers.
上面这篇英文文章是来自http://blogs.msdn.com/b/farukcelik/archive/2007/12/31/udl-test-on-a-64-bit-machine.aspx的,由于我自身英语翻译水平的原因没有翻译,解决方法是:C:\Windows\syswow64\rundll32.exe "C:\Program Files (x86)\Common Files\System\Ole DB\oledb32.dll",OpenDSLFile C:\test.udl  这里的C:\test.udl是你的udl文件的路径。解决问题的思想跟上面的一样。

原创粉丝点击