1

I have an old VB6 app which uses ADO to connect to SQL server databases, as:

Dim cnServer As New ADODB.Connection
cnServer.Provider = "sqloledb"
sConnectString = "Server=" & txtServer.Text & ";" & _
                 "Database=" & txtDatabase.Text & ";" & _
                 "User ID=" & txtUserID.Text & ";" & _
                 "Password=" & txtPassword.Text & ";" & _
                 "Connect timeout=10"
cnServer.Open sConnectString

...which has always worked. But now I need to modify it to connect to an Oracle 11g database. I found this article and modified the code to:

Dim cnServer As New ADODB.Connection
cnVLServer.Provider = "OraOLEDB.Oracle"
sConnectString = "Server=" & txtServer.Text & ";" & _
                 "Data Source=" & txtDatabase.Text & ";" & _
                 "User ID=" & txtUserID.Text & ";" & _
                 "Password=" & txtPassword.Text & ";" & _
                 "Connect timeout=10"
cnVLServer.Open sConnectString

...but when I run it, I get an error that reads 3706, Provider cannot be found. It may not be properly installed. This happens on my development VM (which -- don't laugh -- is still on Win2K Pro), and also on my test machine (which uses Win XP).

Some further searching indicated that oracore11.dll is a dependency, so I went to Oracle's download site and pulled down this DLL as part of a .zip file containing what I take to be the full suite of Windows-related coding tools. However the error still occurs even if I place this DLL in the same folder with my VB6 executable. And when I try to register the DLL, the attempt just generates another error: The specified module could not be found.

Before any further thrashing with what may be a wrong path or an unsolvable problem in the first place, I figured I should check in and see the best/easiest way to get a VB6 app to connect to Oracle in the first place. My goal here is to have this VB6 app be as portable as possible, not requiring any pre-installed packages to work, and having the minimum set of dependencies be easily passed around with the .exe itself. (For reference, this VB6 app is not a commercially-distributed product, just an internally-used testing tool within my own department at work. It takes flat-file fixed width data, parses it, then generates the SQL code to insert it to the DB.)

JDM
  • 1,709
  • 3
  • 25
  • 48

1 Answers1

2

To configure an Oracle Database Instant, you must:

  1. Install the Oracle Database Instant Client and its ODBC driver on your system;
  2. Set the TNS_ADMIN environment variable;
  3. Configure a tnsnames.ora configuration file for your client.

Please refer to this link, for further details...

bastos.sergio
  • 6,684
  • 4
  • 26
  • 36
  • My goal is to have this VB6 app be as portable as possible, not requiring any pre-installed packages to work, and having the minimum set of dependencies be easily passed around with the .exe itself. Is this client package the necessary and only way to get a VB6 app to connect to an Oracle database? – JDM Oct 08 '13 at 00:19
  • Pretty much... And you can count yourself lucky, as before the supported way was to install an exe called the oracle client tools on each client that needed to connect to an oracle database. Now we just have to get the zip file, called the Oracle Database Instant, and configure the oracle connection from there... – bastos.sergio Oct 08 '13 at 10:11
  • Still no luck. I've updated code per some online resources, so probably best that I turn this into a new question. – JDM Oct 08 '13 at 16:22
  • Found the issue. The Oracle DB was configured to use a default service name of "orcl.companyname.int" rather than just the normal "orcl" that all the online resources assume. – JDM Oct 08 '13 at 17:32