Perl script raising oci.dll error, DBD

RobLaw84 picture RobLaw84 · Jul 27, 2011 · Viewed 9k times · Source

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

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

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

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.

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.

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

I can connect to the database using SQLPlus

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

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

Answer

Cosmicnet picture Cosmicnet · Jan 20, 2013

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/

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

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

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

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