简体   繁体   English

使用64位Excel连接到32位Oracle客户端

[英]Connecting to 32 bit Oracle client with 64 bit Excel

I'm trying to connect my Excel to Oracle with this connection string in VBA: 我正在尝试使用VBA中的此连接字符串将Excel连接到Oracle:

dim cn As New ADODB.Connection
cn.Open "Provider=OraOLEDB.Oracle;Data Source=source;User Id=userid;Password=pwd;"

I'm getting this error: 我收到这个错误:

Run-time error '3706':
Provider cannot be found. It may not be properly installed.

Relevant references: 相关参考文献:

Microsoft ActiveX Data Objects 6.1 Library
OraOLEDB 1.0 Type Library
  • Excel is MS Office Professional Plus 2010 64-bit Excel是64位的MS Office Professional Plus 2010
  • Windows is 7 Enterprise, service pack 1, 64 bit Windows是7 Enterprise,Service Pack 1,64位
  • Oracle client is 11.2.0 32 bit (I think) Oracle客户端是11.2.0 32位(我认为)
  • Oracle server is Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production Oracle服务器是Oracle Database 11g企业版11.2.0.3.0版 - 64位生产版

Now... I have scoured the net and cannot figure out what the issue is, but my best guess is there's some 32 bit vs 64 bit conflict with drivers I'm using. 现在......我已经在网上搜索,无法弄清问题是什么,但我最好的猜测是我正在使用的驱动程序有32位与64位冲突。 I'm trying to get a sense of what path I should be taking before I involve my company's IT department to try installing stuff for me. 在我让公司的IT部门尝试为我安装东西之前,我正试图了解我应该采取什么样的方法。 Does the Oracle client have to be 64 bit if MS Office is? 如果MS Office是Oracle客户端必须是64位吗? Or do I just need the 64 bit Oracle Data Access Components? 或者我只需要64位Oracle数据访问组件? I've tried a bunch of different connection strings with no success, including using MSDAORA instead of OraOLEDB.Oracle... 我尝试了一堆不同的连接字符串但没有成功,包括使用MSDAORA代替OraOLEDB.Oracle ......

Yes, when you use 64-bit Excel you must install also 64-bit Oracle Client and 64-bit OLE DB Provider. 是的,当您使用64位Excel时,您还必须安装64位Oracle客户端和64位OLE DB提供程序。

OLE DB Provider from Microsoft (ie MSDAORA ) does not exist for 64-bit. Microsoft的OLE DB提供程序(即MSDAORA )不存在64位。 It exists only for 32-bit and has been deprecated for very long time already. 它仅存在于32位,并且已经被弃用了很长时间。

I don't know whether you need your 32-bit Oracle Client for something else, so maybe you cannot simply remove it from your PC. 我不知道你是否需要你的32位Oracle客户端,所以也许你不能简单地从你的PC上删除它。 Here is an instruction how to install both 32-bit and 64-bit Oracle Client on one machine. 以下是如何在一台计算机上安装32位和64位Oracle客户端的说明。 Install Oracle Client x86 and x64 安装Oracle Client x86和x64

I too had the same issue and the solution is to set the oracle drivers for the excel session to 32 Bit drivers and initiate the excel. 我也有同样的问题,解决方案是将excel会话的oracle驱动程序设置为32位驱动程序并启动excel。

I use the following Bat file to open the excel and it connects to oracle without any issues: 我使用以下Bat文件打开excel,它连接到oracle没有任何问题:

#
 Set Temp=C:\\Temp Set TMP=C:\\Temp Set Oracle_Home= #YourDriveLetterhere - >M:\\ORA12C\\product\\12.1.0\\client_1 Set Path=C:\\Windows;C:\\Windows\\System32;M:\\ORA12C\\product\\12.1.0\\client_1\\bin;M:\\ORA12C\\product\\12.1.0\\client_1\\nls\\mesg;M:\\ORA12C\\product\\12.1.0\\client_1\\network\\admin; START "" "C:\\MacroFileNameWhichConnectsToOracle.xlsm" 
#

The oracle server matters not. oracle服务器不重要。

Try opening a dos window and type c:\\ tnsping yourservername 尝试打开dos窗口并输入c:\\ tnsping yourservername

look towards installation issues. 看看安装问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM