错误ORA-03106在Windows 7 64bit中使用VB6访问Oracle数据库时 [英] Error ORA-03106 When using VB6 to access Oracle database in Windows 7 64bit

查看:120
本文介绍了错误ORA-03106在Windows 7 64bit中使用VB6访问Oracle数据库时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用MS ADO访问数据库时,我收到ORA-03106错误.仅在Windows 7 64位计算机上会出现此问题.过去,XP显然存在问题,但是通过一些注册表编辑器已解决了这些问题.将这些注册表编辑应用于Windows 7计算机后,什么也没做.

I am receiving an ORA-03106 error when I try to access the database using MS ADO. This problem is only occurring on Windows 7 64 bit machines. Apparently there were issues with XP in the past, but they were fixed by some registry edits. These registry edits did nothing when applied to the Windows 7 machine.

我没有太多有关该数据库的信息,因为这是由不同部门处理的,我是一名实习生,这个问题仅是由很少的背景知识引起的.这是代码,我在MyConnection.Open行上收到错误.

I don't have much information about the database because that is handled by a different department, I am an intern and this problem was just thrown at me with very little background info. Here is the code, I get the error on the MyConnection.Open line.

Function db_fetch(sIButtonID, ByRef lstatus, sdescr) As tIBRec

 Dim myRecordSet As ADODB.Recordset

 'Dim sConnectString As String
 Dim sSQL_Statement As String
 Dim this_ibutton As tIBRec

 Set myRecordSet = New ADODB.Recordset

  If Not CheckForNetDrive("O:") Then
    lstatus = Shell("net use O: \\host\oracle /PERSISTENT:YES")
    If Not CheckForNetDrive("O:") Then lstatus = MapNetworkDrive("O:", "\\host\oracle")
    If lstatus = 0 Then
        If InStr(GetEnvironmentVar("PATH"), "orawin95\bin") = 0 Then
            lstatus = SetEnvironmentVariable("PATH", GetEnvironmentVar("PATH") & ";O:\orawin95\bin")
        End If
    End If
  Else
    If InStr(GetEnvironmentVar("PATH"), "orawin95\bin") = 0 Then
        lstatus = SetEnvironmentVariable("PATH", GetEnvironmentVar("PATH") & ";O:\orawin95\bin")
    End If
  End If


  'sConnectString = "Provider=msdaora;Data Source=(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SID=12)(SERVER=DEDICATED)));User Id=username;Password=password;"

  'sConnectString = "Provider=msdaora;Data Source=(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SID=03)(SERVER=DEDICATED)));User Id=username;Password=password;"
  'sConnectString = "Provider=msdaora;Data Source =(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SID=03)(SERVER=DEDICATED)))User Id=username;Password=password;"

  'On Error GoTo err:

  If myConnection.State = 0 Then
      myConnection.Mode = adModeReadWrite
      myConnection.Open sConnectString
  End If

推荐答案

我假定ADO(没有 .NET ),即您的计算机上没有用于OLE DB的Oracle Provider".

I assume the ADO (without .NET), i.e. the "Oracle Provider for OLE DB" is not available on your machine.

解决方案:

  • Install Oracle client 64Bit as usual - I assue this has been done already.
  • Download provider Oracle Provider for OLE DB according your client version in 32Bit, Xcopy version, can be found here: 32-bit Oracle Data Access Components (ODAC) Downloads
  • Unpack the software and install the provider with Install.bat oledb c:\Oracle\OLEDB_11.2_x32\ OraClient11g_home1 true. Assume "OraClient11g_home1" is your Oracle home name. Ensure that the given directory is different to your Oracle client directory!
  • Go to your environment settings and add directory c:\Oracle\OLEDB_11.2_x32\ and c:\Oracle\OLEDB_11.2_x32\bin\ to your PATH environment. Ensure that these directories are placed before your Oracle client home directory.
  • Add environment variable TNS_ADMIN = {Oracle client home diretory}\network\admin

尝试一下是否有效.

一个注意事项:即使安装了多个Oracle客户端,也只能在一台计算机上安装一个版本的用于OLE DB的Oracle Provider".

One note: You can install only one single version of "Oracle Provider for OLE DB" on one machine, even if you have several Oracle clients installed.

按照此过程,我设法使它们都可以同时在Win7 x64和旧XP上运行的Windows 7、64Bit,Oracle 11.2和旧的VBA Excel宏正常工作.

Following this procedure I managed to make all working for Windows 7, 64Bit, Oracle 11.2 and my old VBA Excel Macros which are running on Win7 x64 and old XP at the same time.

对不起,我想念您尝试使用Microsoft OLE DB提供程序(msdaora),此解决方案适用于Oracle提供程序.我不知道它们有什么不同,您只需调整连接字符串即可.

Sorry I missed that you try to use the Microsoft OLE DB Provider (msdaora), this solution is for the Oracle Provider. I don't know how different they are, perhpaps you only have to adapt the connection string.

这篇关于错误ORA-03106在Windows 7 64bit中使用VB6访问Oracle数据库时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆