问题描述
我正在尝试通过Excel连接到Oracle DB.我已经在计算机上从Oracle安装了Instant Client,但是在运行以下代码时收到此消息:
I'm trying to connect to an Oracle DB through Excel. I have installed the Instant Client from Oracle on my machine, but am getting this message when I run this code:
Sub testing()
Dim myConn As Connection: Set myConn = New Connection
Dim mySet As Recordset: Set mySet = New Recordset
Dim CONNSTRING As String
CONNSTRING = "Driver={Microsoft ODBC for Oracle}; " & _
"CONNECTSTRING=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST=xxxxxx.xxx.xxxxxxxxxxx.com)(PORT=1524))" & _
"(CONNECT_DATA=(SERVICE_NAME=dev))); uid=xxxxxxx; pwd=xxxxxxxxxxx;"
myConn.Open CONNSTRING
mySet.Open "SELECT * FROM apps.ap_invoice_lines_interface", myConn, adOpenStatic, adLockBatchOptimistic, adCmdTable
Sheet1.Range("A1").CopyFromRecordset mySet
mySet.Close
myConn.Close
End Sub
我收到的消息是
找不到Oracle(tm)客户端和网络组件.这些组件由Oracle Corporation提供,是Oracle Version 7.3(或更高版本)客户端软件安装的一部分.在安装了这些组件之前,您将无法使用该驱动程序
The Oracle(tm) client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3 (or greater) client software installation. You will be unable to use this driver until these components have been installed
推荐答案
当我们的桌面支持团队安装错误的Oracle客户端时,我经常看到此错误.如果您的应用程序(在这种情况下为Excel)是32位的,则还需要使用32位ODBC和32位Oracle客户端.操作系统或硬件是64位的都没关系.重要的是应用程序.而且似乎大多数MS Office安装都是32位的,即使安装在64位Windows上也是如此.
I see this error frequently when our desktop support team installs the wrong Oracle client. If your application (Excel, in this case) is 32-bit, then you also need to be using 32-bit ODBC and 32-bit Oracle client. It doesn't matter that your OS or hardware is 64-bit. What matters is the application. And it seems that most MS Office installations are 32-bit, even when installed on 64-bit Windows.
这篇关于找不到Oracle客户端和网络组件-Excel VBA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!