windows Perl 脚本引发 oci.dll 错误,DBD

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6847482/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 17:37:55  来源:igfitidea点击:

Perl script raising oci.dll error, DBD

windowsperlocidbd

提问by RobLaw84

I have perl script which connects to an Oracle database, opens a text file and loads the data from the file in a database table, the script works perfectly on my development machine (windows xp 32 bit), however when i load the script to the production server (windows 2003 64 bit) and run it from a command line, it opens a perl.exe - unable to locate component windows, the message says

我有连接到 Oracle 数据库的 perl 脚本,打开一个文本文件并从数据库表中的文件加载数据,该脚本在我的开发机器(windows xp 32 位)上完美运行,但是当我将脚本加载到生产服务器(windows 2003 64 位)并从命令行运行它,它打开一个 perl.exe - 无法定位组件窗口,消息说

This application has failed to start because OCI.dll was not found. Re-installing the application may fix this problem.

由于未找到 OCI.dll,此应用程序无法启动。重新安装应用程序可能会解决此问题。

The command line output is:

命令行输出是:

install_driver(Oracle) failed: Can't load 'C:/Perl64/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:%1 is not a valid Win32 application at C:/Perl64/lib/DynaLoader.pm line 191. at (eval 14) line3 Compilation failde in require at (eval 14) line 3. Perhaps a required shared library or dll isn;t installde where expected at c:\warranty\warrantyImport.pl line 15

install_driver(Oracle) 失败:无法为模块 DBD::Oracle 加载“C:/Perl64/lib/auto/DBD/Oracle/Oracle.dll”:load_file:%1 不是 C:/Perl64 上的有效 Win32 应用程序/lib/DynaLoader.pm line 191. at (eval 14) line3 Compilation failde in require at (eval 14) line 3. 也许需要的共享库或 dll 不是;t installde 预期在 c:\warranty\warrantyImport.pl 行15

I have reinstalled the oracle client, i have tried uninstalling both active perl and the oracle client and then installing the oracle client before perl as heard this might cause the issue.

我已经重新安装了 oracle 客户端,我尝试卸载活动的 perl 和 oracle 客户端,然后在 perl 之前安装 oracle 客户端,因为听说这可能会导致问题。

I thought it could be permissions so i wrote a simple perl script to open to oci.dll and raised an error if unable, it was able to open it correctly.

我认为这可能是权限问题,所以我写了一个简单的 perl 脚本来打开 oci.dll 并在无法打开时引发错误,它能够正确打开它。

I have ensured C:\oracle\product\10.2.0\client_1\bin is in the PATH enviroment variable.

我已经确保 C:\oracle\product\10.2.0\client_1\bin 在 PATH 环境变量中。

I can connect to the database using SQLPlus

我可以使用 SQLPlus 连接到数据库

I have added the OCI.dll to the same directory as the perl script.

我已将 OCI.dll 添加到与 perl 脚本相同的目录中。

and i've now finally run out of ideas....can anyone suggest anything, i'm tearing my hair out trying to get it working.

我现在终于没有想法了......任何人都可以提出任何建议,我正在努力让它发挥作用。

Details Server is running ActivePerl 5.14.1 Build 1401 (64-bit) Oracle database is 10g Oracle client is 10.2.0

详细信息 服务器正在运行 ActivePerl 5.14.1 Build 1401(64 位) Oracle 数据库为 10g Oracle 客户端为 10.2.0

回答by Cosmicnet

I had a similar issue but for the 64bit version of Perl. I managed to resolve it by getting the correct client libraries and reading this guide:
http://www.pythian.com/news/11115/dbdoracle-and-windows-64bit/

我有一个类似的问题,但对于 64 位版本的 Perl。我设法通过获取正确的客户端库并阅读本指南来解决它:http:
//www.pythian.com/news/11115/dbdoracle-and-windows-64bit/

Bascially, I'm running Oracle 11g XE R2, which only comes as 32bit. So I suspected that it was looking for the 64bit client libraries and not finding them. So I downloaded:
instantclient-basic-windows.x64-11.2.0.3.0.zip
instantclient-sqlplus-windows.x64-11.2.0.3.0.zip
instantclient-sdk-windows.x64-11.2.0.3.0.zip
From:
http://www.oracle.com/technetwork/topics/winx64soft-089540.html
And installed to c:\oraclexe\instantclient_11_2

基本上,我正在运行 Oracle 11g XE R2,它只有 32 位。所以我怀疑它是在寻找 64 位客户端库而不是找到它们。于是我下载了:
instantclient-basic-windows.x64-11.2.0.3.0.zip
instantclient-sqlplus-windows.x64-11.2.0.3.0.zip
instantclient-sdk-windows.x64-11.2.0.3.0.zip
来自:
http://www.oracle.com/technetwork/topics/winx64soft-089540.html
并安装到 c:\oraclex\instantclient_11_2

I added these to my path:
C:>set PATH = c:\oraclexe\instantclient_11_2;%PATH%
But unfortunately the error persisted :(

我将这些添加到我的路径中:
C:>set PATH = c:\oraclex\instantclient_11_2;%PATH%
但不幸的是错误仍然存​​在:(

On checking my PATH:
echo %PATH%
I could see that the set was getting ignored. I guess that was a permissions issue.

在检查我的 PATH:
echo %PATH%
我可以看到该集合被忽略了。我猜这是一个权限问题。

So I edited the system path variable and restarted the command prompt. This fixed the issue and allowed me to connect :)

所以我编辑了系统路径变量并重新启动了命令提示符。这解决了问题并允许我连接:)

回答by bohica

Have you mixed some 32 bit and 64 bit components. Obviously you need 64 bit Perl, 64 bit DBI and DBD::Oracle and 64 bit dlls for Oracle client. I only suggest you check as the error says "is not a valid Win32 application at".

您是否混合了一些 32 位和 64 位组件。显然,您需要 64 位 Perl、64 位 DBI 和 DBD::Oracle 以及 Oracle 客户端的 64 位 dll。我只建议您检查,因为错误显示“不是有效的 Win32 应用程序”。