سؤال

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.)

هل كانت مفيدة؟

المحلول

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...

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top