I have an old VB6 app which uses ADO to connect to SQL server databases, as:
我有一个旧的VB6应用程序,它使用ADO连接到SQL server数据库,
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:
…一直工作。但是现在我需要修改它以连接到Oracle 11g数据库。我找到了这篇文章并将代码修改为:
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).
…但是当我运行它时,我得到一个读取3706的错误,无法找到提供者。可能安装不当。这发生在我的开发VM(不要笑)上,也发生在我的测试机器(使用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.
进一步的搜索表明,那是奥拉科鲁尼亚。dll是一个依赖项,所以我去了Oracle的下载站点,将这个dll作为.zip文件的一部分,其中包含了我所认为的与windows相关的编码工具的完整套件。但是,即使我将这个DLL放在与VB6可执行文件相同的文件夹中,仍然会发生错误。当我尝试注册DLL时,尝试只会产生另一个错误:无法找到指定的模块。
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.)
在进一步讨论错误路径或无法解决的问题之前,我想我应该先检查一下,看看最好的/最简单的方法,让VB6应用程序首先连接到Oracle。我的目标是使这个VB6应用程序尽可能的可移植性,不需要任何预先安装的包来工作,并且使最小的依赖集能够轻松地与.exe本身传递。(举例来说,这个VB6应用并不是一个商业分布式的产品,只是我所在部门内部使用的测试工具。它获取平面文件的固定宽度数据,对其进行解析,然后生成SQL代码将其插入到DB中。
1 个解决方案
#1
1
To configure an Oracle Database Instant, you must:
要立即配置Oracle数据库,您必须:
- Install the Oracle Database Instant Client and its ODBC driver on your system;
- 在您的系统上安装Oracle数据库即时客户端及其ODBC驱动程序;
- Set the TNS_ADMIN environment variable;
- 设置TNS_ADMIN环境变量;
- Configure a tnsnames.ora configuration file for your client.
- 配置以及。客户端配置文件。
Please refer to this link, for further details...
详情请参阅此连结。
#1
1
To configure an Oracle Database Instant, you must:
要立即配置Oracle数据库,您必须:
- Install the Oracle Database Instant Client and its ODBC driver on your system;
- 在您的系统上安装Oracle数据库即时客户端及其ODBC驱动程序;
- Set the TNS_ADMIN environment variable;
- 设置TNS_ADMIN环境变量;
- Configure a tnsnames.ora configuration file for your client.
- 配置以及。客户端配置文件。
Please refer to this link, for further details...
详情请参阅此连结。