如何让“Microsoft ODBC for Oracle”驱动程序在 Windows 7 中工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19800590/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I get the "Microsoft ODBC for Oracle" driver to work in Windows 7
提问by BIBD
I have an old VB6 app that I need to get working on a Windows 7 x64 workstation (at least for a little while).
我有一个旧的 VB6 应用程序,我需要在 Windows 7 x64 工作站上工作(至少需要一段时间)。
It's failing on me when I try to connect to my test database (Oracle 10gR2). I get an "ORA-06413: Connection not open error."
当我尝试连接到我的测试数据库 (Oracle 10gR2) 时,它失败了。我收到“ORA-06413:连接未打开错误”。
Now, I recognise that the "Microsoft ODBC for Oracle" driver is deprecated because it doesn't play nice with newer versions of Oracle. It seems to work fine with the same database on an XP box I have access to.
现在,我认识到“Microsoft ODBC for Oracle”驱动程序已被弃用,因为它不适用于较新版本的 Oracle。在我可以访问的 XP 机器上使用相同的数据库似乎可以正常工作。
I also see that the driver seems to still exist on Windows 7 x64 (at least when I look at the 32 bit version of the ODBC data Source Administrator tool: c:\Windows\SysWOW64\odbcad32.exe in the Drivers tab.
我还看到驱动程序似乎仍然存在于 Windows 7 x64 上(至少当我查看 32 位版本的 ODBC 数据源管理器工具时:驱动程序选项卡中的 c:\Windows\SysWOW64\odbcad32.exe。
On the XP box, it doesn't seem to matter what I see up for an ODBC connection, it seems to bypass any sort of predefined connection.
在 XP 机器上,我看到的 ODBC 连接似乎无关紧要,它似乎绕过了任何类型的预定义连接。
Attached is the relevant code. Is there any way to make this work in Win7x64?
附上相关代码。有什么办法可以在 Win7x64 中完成这项工作吗?
Global g_sConnectionString As String
Global g_oConn As ADODB.Connection
Public Sub CreateOracleConn()
Err.Clear
On Error Goto ConnectionError
g_sConnectionString = "Driver={Microsoft ODBC for Oracle}; " _
& "SERVER=" & "MyHost" _
& ";UID=" & "MyUserID" _
& ";PWD=" & "MyPassword & ";"
Set g_oConn = New ADODB.Connection
g_oConn.Open g_sConnectionString '<-- fails here
Exit Sub
ConnectionError:
If Err.Number <> 0 Then
'Clean up from the error
End If
End Sub
回答by BIBD
The problem entirely relates to where Visual Basic 6 is installed. By default it is installed in C:\Program Files (x86)\Microsoft Visual Studio\VB98\VB6.EXE
问题完全与 Visual Basic 6 的安装位置有关。默认情况下,它安装在C:\Program Files (x86)\Microsoft Visual Studio\VB98\VB6.EXE
If you change its location to something like:
C:\ProgramFilesX86\Microsoft Visual Studio\VB98\VB6.EXE
如果您将其位置更改为:
C:\ProgramFilesX86\Microsoft Visual Studio\VB98\VB6.EXE
It runs properly.
它运行正常。