[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tips for perl scripts to connect oracle database



 
    
tips for perl scripts to connect oracle database
------------------------------------------------

Two boxes, one is running oracle database (espresso), another only 
installed oracle client software (latte). They are running same
version of OS and perl

1. build perl modules:

DBD-Oracle-1.14
DBI-1.38 

on espresso

2. copy built and installed perl modules across to latte

3, on latte web server perl cgi-bin scripts, add some thing like:

...
use lib "/oracle/local/perl/lib/perl5/site_perl/5.8.0/alpha-dec_osf/";
...

where DBD.pm and DBI.pm are, and:

...
$ENV{LD_LIBRARY_PATH} = '/oracle/app/9ias/lib';
...

where libclntsh.so.9.0 is
 
Some Oracle Database has two version of libraries:

[siwc@tequila Oracle]$ file /oracle/bkup/lib/libclntsh.so.9.0 
/oracle/bkup/lib/libclntsh.so.9.0:      ELF 64-bit MSB dynamic lib SPARCV9 Version 1, dynamically linked, not stripped

[siwc@tequila Oracle]$ file /oracle/bkup/lib32/libclntsh.so.9.0 
/oracle/bkup/lib32/libclntsh.so.9.0:    ELF 32-bit MSB dynamic lib SPARC Version 1, dynamically linked, not stripped

When you build and run DBD-Oracle, you need set up:

[siwc@tequila Oracle]$ env |grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/oracle/bkup/lib32

Otherwise you will get error:
...
install_driver(Oracle) failed: Can't load '/servers/web/lib/perl5/site_perl/5.8.3/sun4-solaris/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: ld.so.1: /servers/web/bin/perl: fatal: /oracle/bkup/lib/libclntsh.so.9.0: wrong ELF class: ELFCLASS64 at /servers/web/lib/perl5/5.8.3/sun4-solaris/DynaLoader.pm line 229.
 at (eval 1) line 3
Compilation failed in require at (eval 1) line 3.
...

in Oracle.pm it says:
...
If using dynamic linking then ORACLE_HOME should match the version of 
Oracle that will be used to load in the Oracle client libraries (via 
LD_LIBRARY_PATH, ldconfig, or similar on Unix).
...

Google