Unable to Install DBD::Oracle for Perl on Windows

2.2k views Asked by At

When trying to install DBD::Oracle library i received the following error message "Can't load /usr/lib/perl5/site_perl/5.24/x86_64-cygwin-threads/auto/DBD/Oracle/Oracle.dll for module DBD::Oracle: No such file directory at /usr/lib/perl5/5.24/x86_64-cygwin-threads/DynaLoader.pm"

I installed the DBD::Oracle library on windows using the below steps:

instantclient-basic-11.2.0.4.0

instantclient-sqlplus-11.2.0.4.0

instantclient-sdk-11.2.0.4.0

Then, I unzip them all to c:\Oracle. Next, I included the below directory in my system environmental on windows as shown below

ORACLE_HOME=C:\Oracle\instantclient_11_2 LD_LIBRARY_PATH=C:\Oracle\instantclient_11_2\lib (There is no lib directory in this folder, but i followed the instructions of an online article regardless)

Finally, I opened command prompt and ran and received that error message:

perl -MCPAN -e "install DBD::Oracle"

1

There are 1 answers

0
Jelani On BEST ANSWER

I resolved the problem by installing the 32-bit Oracle Client 11g version onto the computer in this location c:\oracle. It doesn't work using the instantclient version because the instant client doesn't contain the necessary libraries.

Download "Oracle Database 11g Release 2 Client (11.2.0.1.0) for Microsoft Windows (32-bit)" from the below link and install the full administrator verion http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html

Next, create ORACLE_HOME variable in your environmental variables on your computer and add the following path to it: ORACLE_HOME=C:\Oracle\product\11.2.0\client_1

Next, create LD_LIBRARY_PATH variable and add the below path: LD_LIBRARY_PATH=C:\Oracle\product\11.2.0\client_1\lib

Afterwards, install module using perl without testing it. During the test it will fail, because its trying to connect to your database:

  1. perl -MCPAN -e shell
  2. notest install DBD::Oracle

Open the odbcad32.exe in this location C:\Windows\SysWOW64\ and click Add. Type Oracle for the name and description and click save. The SysWOW64 will connect the 32-bit version of the odbcad32 application to create the reference.

NOTE: The biggest problem you will have is to ensure you are using 32-bit drivers using cygwin, oracle software, and odbcad32. You will receive that can't load library if you mix 64-bit drivers with 32-bit drivers.

Reopen any command prompt window and try running your perl script again.