http://www.perlmonks.org?node_id=1015753

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

I've done the SuperSearch, and the reg'lar Google thing, but nothing hss clicked,as of yet. I'm hoping this will get the ball rolling, so to speak.

BEGIN { $ENV{ORACLE_HOME}="/export/home/riedward/oraclient"; $ENV{TNS_ADMIN}="/export/home/riedward/oraclient"; $ENV{NLS_LANG}=""; $ENV{LD_LIBRARY_PATH}="/lib:/usr/lib:/export/home/riedward/oraclient/s +dk:/export/home/riedward/oraclient"; $ENV{PATH}="/usr/bin:/usr/sbin:/usr/lib:/export/home/riedward/oraclien +t"; $ENV{PERL_LOCAL_LIB_ROOT}="/export/home/riedward/perl5"; $ENV{PERL_MB_OPT}="--install_base /export/home/riedward/perl5"; $ENV{PERL_MM_OPT}="INSTALL_BASE=/export/home/riedward/perl5"; $ENV{PERL5LIB}="/export/home/riedward/perlmodules:/export/home/riedwar +d/perl5/lib/perl5/sun4-solaris-64int:/export/home/riedward/perl5/lib/ +perl5"; } use DBI; use DBD::Oracle;
If I set each of the listed env vars in my .profile, all is well. If I don't, and only set them in my script, then I get the dreaded DBD::Oracle error:
Can't load '/export/home/riedward/perlmodules/sun4-solaris-64int/auto/ +DBD/Oracle/Oracle.so' for module DBD::Oracle: ld.so.1: perl: fatal: l +ibclntsh.so.10.1: open failed: No such file or directory at /usr/perl +5/5.8.4/lib/sun4-solaris-64int/DynaLoader.pm line 230.

I've been messing with this for a while now, so the paths may be a bit convoluted. Any insights are worth beer....

Replies are listed 'Best First'.
Re: Perl and paths...again :-(
by Corion (Patriarch) on Jan 28, 2013 at 20:05 UTC

    It may be on your OS that $ENV{LD_LIBRARY_PATH} needs to be set before your process is launched. So either set the values and re-exec your program, or set the values from a shell script.

    BEGIN { if(! $ENV{RELAUNCH}) { $ENV{RELAUNCH}=1; $ENV{ORACLE_HOME}="/export/home/riedward/oraclient"; ... exec $0 => @ARGV; }; };
Re: Perl and paths...again :-(
by SuicideJunkie (Vicar) on Jan 28, 2013 at 20:10 UTC

    Perhaps try setting $FMW{...}="..."; instead.

    Then

    for my $key (keys %FMW) { print "fmw-$key =\[$FMW{$key}\]\n"; print "env-$key =\[$ENV{$key}\]\n"; print "MISMATCH!\n" if $FMW{$key} ne $ENV{$key}; }
    and compare to see if there are any odd escape characters or encoding issues or whatnot.

Re: Perl and paths...again :-(
by Plankton (Vicar) on Jan 29, 2013 at 06:08 UTC
    Is the Oracle.so on an auto mounted filesystem? If so your problem maybe automounter. update: also do you have the oracle client installed? Does sqlplus work?