We help IT Professionals succeed at work.

Perl DBD - Can't locate loadable object for module DBD::Oracle in @INC

Tbone3434
Tbone3434 asked
on
Hello,

I am trying to get DBD-Oracle-1.3.4 up and running on RHEL 5.  I did see similar posts regarding this however it appears they were for windows.

I have DBI 1.52 installed along with Oracle instant Client and I am able to connect via a PHP script and also via sqlplus so I know client is installed ok.  I have set the environmental variables in my .profile as follows:

export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export TNS_ADMIN=/usr/lib/oracle/11.2/client64/network/admin
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib

Here are the steps I took:
I extracted DBD-Oracle-1.3.4
I ran perl Makefile.PL INSTALLBASE=/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
make
make install

After the install is done I run this command to validate version:
 perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,"\n";'
which returns this:

Can't locate loadable object for module DBD::Oracle in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at -e line 1
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

Any idea on this?  I really appreciate the help as i have been trying for quite some time to get this resolved.  Thanks!
Comment
Watch Question

You do not appear to have Perl module installed for Oracle.

You can use cpan and install it

Example:

> sudo cpan
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.9800)
Enter 'h' for help.

cpan[1]> h

Display Information                                                (ver 1.9800)
 command  argument          description
 a,b,d,m  WORD or /REGEXP/  about authors, bundles, distributions, modules
 i        WORD or /REGEXP/  about any of the above
 ls       AUTHOR or GLOB    about files in the author's directory
    (with WORD being a module, bundle or author name or a distribution
    name of the form AUTHOR/DISTRIBUTION)

Download, Test, Make, Install...
 get      download                     clean    make clean
 make     make (implies get)           look     open subshell in dist directory
 test     make test (implies make)     readme   display these README files
 install  make install (implies test)  perldoc  display POD documentation

Upgrade
 r        WORDs or /REGEXP/ or NONE    report updates for some/matching/all modules
 upgrade  WORDs or /REGEXP/ or NONE    upgrade some/matching/all modules

Pragmas
 force  CMD    try hard to do command  fforce CMD    try harder
 notest CMD    skip testing

Other
 h,?           display this menu       ! perl-code   eval a perl command
 o conf [opt]  set and query options   q             quit the cpan shell
 reload cpan   load CPAN.pm again      reload index  load newer indices
 autobundle    Snapshot                recent        latest CPAN uploads
cpan[2]>

Author

Commented:
Thanks Farzani but I must admint I am a bit confused... Isn't DBD-Oracle the Perl module for Oracle in which case I have already installed it in this directory:

/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/lib/perl5/x86_64-linux-thread-multi/DBD/Oracle.pm

Thanks!
johnsoneSenior Oracle DBA
Commented:
I am not great a perl.  However, the path where you have the Oracle.pm module is not in the INC path.

Just looking at the first 2 parts for the path tell you that.  INC is looking in /usr/lib and you have it in /usr/lib64.

That may mean you are running a 32 bit OS and installed a 64 bit module which will likely cause problems, you need to move the DBD modules, or you need to update INC.
Nem SchlechtIT Supervisor
Top Expert 2009

Commented:
When you build the module, did you do a 'make test' before you did a 'make install'?

Author

Commented:
Thanks guys, I added a couple paths to INC and that fixed it.
Glad to help