as00060 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Members,

I have installed DBD::Oracle from CPAN, following is the o/p of the "perl makefile"...... ++++++++++++++++++++++++++++

Using DBI 1.633 (for perl 5.020002 on x86_64-linux-thread-multi) insta +lled in /opt/perl/ActivePerl-5.20/lib/auto/DBI/ Configuring DBD::Oracle for perl 5.020002 on linux (x86_64-linux-threa +d-multi) Remember to actually *READ* the README file! Especially if you have an +y problems. Trying to find an ORACLE_HOME Your LD_LIBRARY_PATH env var is set to '/u01/app/oracle/product/11.2.0 +/xe/lib' Found /u01/app/oracle/product/11.2.0/xe WARNING: Setting ORACLE_HOME env var to /u01/app/oracle/product/11.2.0 +/xe for you. WARNING: If these tests fail you may have to set ORACLE_HOME yourself! Installing on a linux, Ver#3.2 Using Oracle in /u01/app/oracle/product/11.2.0/xe DEFINE _SQLPLUS_RELEASE = "1102000200" (CHAR) Oracle version 11.2.0.2 (11.2) Found /u01/app/oracle/product/11.2.0/xe/rdbms/demo/demo_xe.mk Using /u01/app/oracle/product/11.2.0/xe/rdbms/demo/demo_xe.mk Looks like Oracle XE (/u01/app/oracle/product/11.2.0/xe/rdbms/demo/dem +o_xe.mk) Reading /u01/app/oracle/product/11.2.0/xe/rdbms/demo/demo_xe.mk Your LD_LIBRARY_PATH env var is set to '/u01/app/oracle/product/11.2.0 +/xe/lib' client_version=11.2 DEFINE= -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"11.2.0.2 +\" -DORA_OCI_102 -DORA_OCI_112 Checking for functioning wait.ph System: perl5.020002 linux perl-stackato64-precise 3.2.0-24-virtual #3 +9-ubuntu smp mon may 21 18:44:18 utc 2012 x86_64 x86_64 x86_64 gnulin +ux Compiler: gcc -O2 -D_REENTRANT -D_GNU_SOURCE -DUSE_SITECUSTOMIZE -DP +ERL_RELOCATABLE_INCPUSH -fno-merge-constants -fwrapv -fno-strict-alia +sing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS= +64 Linker: not found Sysliblist: -ldl -lm -lpthread -lnsl -lirc Oracle makefiles would have used these definitions but we override the +m: CC: /usr/bin/gcc LDFLAGS: -g [-g] Linking with -L/u01/app/oracle/product/11.2.0/xe/lib/ -lclntsh -lpthre +ad Warning (mostly harmless): No library found for -lpthread LD_RUN_PATH=/u01/app/oracle/product/11.2.0/xe/lib Using DBD::Oracle 1.74. Using DBD::Oracle 1.74. Using DBI 1.633 (for perl 5.020002 on x86_64-linux-thread-multi) insta +lled in /opt/perl/ActivePerl-5.20/lib/auto/DBI/ Generating a Unix-style Makefile Writing Makefile for DBD::Oracle Writing MYMETA.yml and MYMETA.json
++++++++++++++++++++++++++++++++++++ Following is the output of "perl dbi.pl" -----------------------------------
perl dbi.pl Uncaught exception from user code: install_driver(Oracle) failed: Can't load '/opt/perl/ActivePer +l-5.20/lib/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclnt +sh.so.12.1: cannot open shared object file: No such file or directory + at /opt/perl/ActivePerl-5.20/lib/DynaLoader.pm line 194. at (eval 6) line 3. Compilation failed in require at (eval 6) line 3. Perhaps a required shared library or dll isn't installed where + expected at dbi.pl line 8. DBI::install_driver("DBI", "Oracle") called at /opt/perl/Activ +ePerl-5.20/lib/DBI.pm line 662 DBI::connect("DBI", "dbi:Oracle:host=192.168.0.10", undef, und +ef) called at dbi.pl line 8
------------------------------------

Following is the code ---------------------- ----------------------
1 use DBI; 2 use diagnostics; 3 use strict; 4 #use DBD::Oracle; 5 6 my($dbh,$dbuser,$dbpass,$SEL,$sth,$db); 7 8 $dbh = DBI->connect("dbi:Oracle:host=192.168.0.10", $dbuser, $ +dbpass)|| die "$!"; 9 10 $db->{AutoCommit} = 0; 11 12 $db->{RaiseError} = 1; 13 14 $db->{ora_check_sql} = 0; 15 16 $db->{RowCacheSize} = 16; 17 18 $SEL = "SELECT * FROM HR"; 19 $sth = $db->prepare($SEL); 20 $sth->execute(); 21 22 while ( my @row = $sth->fetchrow_array() ) { 23 foreach (@row) { 24 $_ = "\t" if !defined($_); 25 print "$_\t";
+++++++++++++++++++++++++++++++++++++++++++++++++++
ls -l | grep -i libclntsh.so lrwxrwxrwx. 1 oracle dba 17 Sep 25 23:00 libclntsh.so -> libclnt +sh.so.11.1 -rwxr-xr-x. 1 oracle dba 41051464 Aug 29 2011 libclntsh.so.11.1 [root@localhost lib]# pwd /u01/app/oracle/product/11.2.0/xe/lib
+++++++++++++++++++++++++++++++++++++++++++++++++++ What I see is the library file is present, but the version mismatch is observed. Any other suggestion would be highly appreciated. Regards, Amitesh

Replies are listed 'Best First'.
Re: issue with DBD::Oracle module
by Corion (Patriarch) on Sep 26, 2015 at 12:32 UTC

    From the output of Makefile.PL

    If these tests fail you may have to set ORACLE_HOME yourself!

    Have you done that?

    Also, you might need to tell your OS where to find the Oracle shared libraries. Have you adjusted $ENV{LD_LIBRARY_PATH} accordingly?

      Hi, I have already set the ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe It was set by executing the ". ./oracle_env.sh" from the location /u01/app/oracle/product/11.2.0/xe/bin/ and for "LD_LIBRARY_PATH", following is the o/p of .bash_profile. --------------------------------------- cat .bash_profile # .bash_profile # Get the aliases and functions if -f ~/.bashrc ; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin . /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh export PATH LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/xe/lib export LD_LIBRARY_PATH ------------------------------------ Still the same error
Re: issue with DBD::Oracle module
by Anonymous Monk on Sep 27, 2015 at 07:46 UTC

      following is the o/p.

      +++++++++++++++++++++++++++++++ ldd -v /opt/perl/ActivePerl-5.20/lib/auto/DBD/Oracle/Oracle.so linux-vdso.so.1 => (0x00007fffd4f00000) libclntsh.so.12.1 => not found libc.so.6 => /lib64/libc.so.6 (0x00007f9d49947000) /lib64/ld-linux-x86-64.so.2 (0x00007f9d49f4e000) Version information: /opt/perl/ActivePerl-5.20/lib/auto/DBD/Oracle/Oracle.so: libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6 libc.so.6 (GLIBC_2.14) => /lib64/libc.so.6 libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6 libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6 /lib64/libc.so.6: ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x8 +6-64.so.2 ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linu +x-x86-64.so.2 +++++++++++++++++++++++++++++++++

      As suspected the libclntsh.so.12.1 is missing from the libraries.

      Regards, Amitesh Sahay

        As suspected the libclntsh.so.12.1 is missing from the libraries.

        So where is that file? What does ldd......libclntsh.so.12.1 return?