1

We have a number of applications written in VB6 (not .NET) that have been running for almost 20 years. These applications are running on Windows 2007 64bit servers and connecting to Oracle-11 with a 32bit client. The connection string contains "Provider=OraOLEDB.Oracle" So far, so good.

The problem is that we need to convert, for reasons that go beyond the scope of this thread) to Oracle-12 64bit. After having installed the Oracle 12-client (and disinstalled the Oracle-11 client), we get the following error when trying to open the connection: "Provider cannot be found. It may not be properly installed."

I'm sure we did install the client and am therefore afraid that VB6 cannot connect to Oracle using the 64bit client.

Apparently easy solutions are unfortunately out of the question:
- Convert to .NET or whatsoever and compile under 64 bit
- Keep the 32bit oracle client.

Any idea how to risolve this?

Robert Kock
  • 5,795
  • 1
  • 12
  • 20

2 Answers2

4

OLE-DB

Good news and bad; because Visual Basic 6.0 is a 32 bit program with no 64 bit compiler, the 32 bit Oracle Data Access Components software must be installed, even if the database itself is running on a 64 bit server in a 64 bit Oracle Database install, specifically you need the 32 bit Oracle Provider for OLE DB rather than the whole client.

The driver can be found here (Download the ODAC XCopy version): http://www.oracle.com/technetwork/database/windows/downloads/utilsoft-087491.html

The following thread describes your exact problem and instructions on fixing it: https://hoopercharles.wordpress.com/2012/11/25/connecting-to-an-oracle-database-with-visual-basic-6-0-on-windows-8-64-bit/

ODBC drivers

Another way to connect is to use ODBC drivers instead, there are pros and cons to each method so google to find them.

First you'll need to install the SQORA32 ODBC driver which comes with the 64 bit client or with the ODAC linked above.

Next, you'll need to create an ODBC connection, instructions can be found here: https://tensix.com/2012/06/setting-up-an-oracle-odbc-driver-and-data-source/

Finally you need to change your connections strings in VB6 to use the newly created ODBC connections. Something along the lines of the following should work nicely (obviously nameOfDatabase is the name given to your odbc connection):

Provider=MSDASQL;Dsn=nameOfDatabase;Uid=usernameHere;Pwd=passwordHere

Be careful when you set up your DSN, make sure you use the 32 bit ODBC connection manager which can be found in the following location:

c:\windows\sysWOW64\odbcad32.exe

The same program can be found in the system32 folder but that's the 64 bit version....not confusing at all!

twoleggedhorse
  • 4,938
  • 4
  • 23
  • 38
  • I tried the solution as stated in the hoopercharles site but it doesn't fix my problem. We cannot have the 32- and 64-bit client contemporarily (we need the 64bit for other purposes as well). I'm working on the ODBC thread. I'll be back (it's midnight over here) – Robert Kock Sep 29 '17 at 22:01
  • I created an ODBC DSN that uses the driver SQORA32.DLL (that comes despite its name, with the 64bit client). The connection string "Provider=MSDASQL;Dsn=TestOracle;Uid=hello;Pwd=there". It seems to work. Does this make sense? – Robert Kock Sep 29 '17 at 22:20
  • Yes it does, we use ODBC connections rather than oledb because we have dao and sql server. I'll post the relevant ODBC stuff up for future reference – twoleggedhorse Sep 29 '17 at 22:23
  • Actually, it does because VB6 does not have a 64 bit compiler – twoleggedhorse Sep 30 '17 at 12:50
  • Unfortunately, it didn't work. When running "wscript", the ODBC connection works. Within our application we get the error: "[Mircosoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and the Application". The very same thing happens when launching the 32-bit "c:\windows\SysWOW64\wscript" – Robert Kock Oct 02 '17 at 07:17
  • @RobertKock Have you set up a dsn using the 32 bit driver? c:\windows\sysWOW64\odbcad32.exe. Answer updated to show this – twoleggedhorse Oct 02 '17 at 07:29
  • When launching "c:\windows\sysWOW64\odbcad32.exe" I don't see the the driver "Oracle in OraClient12Home1" that uses SQORA32.DLL. Any idea how to install that one in the 32bit ODBC configurator? It does show "Microsoft ODBC for Oracle" that uses MSORCL32.DLL but it complains that the client components were not found. – Robert Kock Oct 02 '17 at 07:53
  • That suggests that the 32 bit version oracle driver hasn't been properly installed or is in a different location – twoleggedhorse Oct 02 '17 at 09:24
  • In your question you stated that your uninstalled the 32-bit Oracle 11 Client. Of course, then the 32 bit ODBC driver does not work. You have to install a 32 bit Oracle client. – Wernfried Domscheit Oct 03 '17 at 08:18
  • This is what I was afraid of: There's no way to make VB6 connect to oracle with only a 64bit client installed. – Robert Kock Oct 03 '17 at 09:10
0

(If you can't follow the solution of twoleggedhorse, which is way better.)

You can write a small DLL in .NET 32bit, and make it COM visible so it will be usable by your 32 bits application.

I said in my comment that it seems to be possible in .NET to talk with the DB without an installed client.

To make it through the least painful, you can write it ADO-like (ie a class to replace RecordSet, another for Connection, and so on). Then add it as a reference to your projects and perform a search/replace.

Amessihel
  • 5,891
  • 3
  • 16
  • 40