3

I am trying to create an ODBC connection in a VBA script to an Oracle database, and I get the following error:

Run-time error '-2147467259  (800004005)':
Specified driver could not be loaded due to system error 193: (Oracle in instantclient_11_2, C:\apps\oracle\11.2.0.3\instant-32\SQORA32.dll)
  • When going to %systemdrive%\Windows\SysWoW64\odbcad32.exe I can see my driver "instantclient_11_2" and the file "SQORA32.dll" and it works perfectly when connecting to the db in Python.

  • When using regedit, in Computer\HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers I can see the driver too.

  • Here is my code, I tried two different connection strings:

    -strCon = "DRIVER={Oracle in instantclient_11_2};DBQ=MyDBQ;UID=MyID;PWD=MyPWD"

    -strCon = "Driver={Oracle in instantclient_11_2}; " & _ "CONNECTSTRING=(DESCRIPTION=" & _ "(ADDRESS=(PROTOCOL=TCP)" & _ "(HOST=MyServer)(PORT=MyPort))" & _ "(CONNECT_DATA=(SID=MySID))); uid=MyID;pwd=MyPWD;"

  • My MS Excel version is in 32 bits and so is my driver (SQORA32.dll) so I assume it doesn't have anything to do with a 322/64 versions problem, but I may be wrong.

Any help/advice/solution is welcome.

Community
  • 1
  • 1
astudentofmaths
  • 1,122
  • 2
  • 19
  • 33

1 Answers1

0

You use 32 bit Excel. You must also install 32 bit Oracle Client, I assume this is the case since folder is named "C:\apps\oracle\11.2.0.3\instant- 32\". But verify where you downloaded the client, there are only minor visible differences between 32 and 64 bit version.

For example filename is SQORA32.dll for both, 32 and 64 bit version.

However, check registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI\ODBC Drivers instead of HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers in order to see the 32 bit ODBC drivers.

Update your registry if needed.

Also check whether folder C:\apps\oracle\11.2.0.3\instant-32\ is in your PATH environment variable.

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • Thanks. Yes I already replaced the `SQORA32.dl` by the one from the 32 bit version and also tried with the one from de 64 bit version. But I still had the same error. The `PATH` is fine as well. And I have the right driver in regedit `HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers`. Any other idea ? – astudentofmaths Aug 10 '16 at 11:54
  • No, you have to check `HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI\ODBC Drivers`! You look at location for 64 bit drivers. You have to install entire Oracle client 32 bit version, you cannot replace single DLL's this will not work. – Wernfried Domscheit Aug 10 '16 at 12:21
  • Mea culpa, wrong copy/paste. I checked `HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI\ODBC Drivers`. I uninstalled my version and download a new one and install it, but I have the same error. – astudentofmaths Aug 11 '16 at 09:06
  • Now it gets difficult. Again check carefully whether your Excel is 32 bit and **all** installed Oracle components are also 32 bit. Check all folders in `PATH` environment variable (i.e. Oracle 64 bit folders must not come first - if existing). Maybe something was left when you uninstalled Oracle, see http://stackoverflow.com/questions/8450726/how-to-uninstall-completely-remove-oracle-11g-client – Wernfried Domscheit Aug 11 '16 at 09:49
  • I carefully checked that everything was gone before reinstalling everything. But thank you. I finally did everything in Python (sql connection and excel file filing). But as far as I researched, it seems that Oracle and Excel don't go along very well. – astudentofmaths Aug 22 '16 at 15:15