I'm having trouble with DBI and DBD::Oracle. I think that it has to do with setting of the LD_LIBRARY_PATH variable, so that DBI can dynamically load what it needs to access the Oracle database.
First, my initial code:
use DBI;
$ENV{ORACLE_HOME} = '/common/oracle/product/v8.1.6';
$ENV{LD_LIBRARY_PATH} = "$ENV{ORACLE_HOME}/lib";
$ENV{TNS_ADMIN} = '/common/oracle/env';
$dbh = DBI->connect('','scmuser/scmuser@itopstst','','Oracle');
die $DBI::errstr unless defined $dbh;
This fails with the following error:
install_driver(Oracle) failed: Can't load '/app/eol/perl/lib/site_perl
+/5.005/sun4-solaris/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle
+: ld.so.1: /app/eol/perl/bin/perl: fatal: libclntsh.so.8.0: open fail
+ed: No such file or directory at /app/eol/perl/lib/5.00503/sun4-solar
+is/DynaLoader.pm line 169.
at (eval 1) line 3
at ./tst line 15
This file, is indeed in $LD_LIBRARY_PATH/libclntsh.so.8.0. As evidence, if I set LD_LIBRARY_PATH in my shell before executing this script, it works fine. That led me to try this with a BEGIN block:
BEGIN {
$ENV{ORACLE_HOME} = '/common/oracle/product/v8.1.6';
$ENV{LD_LIBRARY_PATH} = "$ENV{ORACLE_HOME}/lib";
$ENV{TNS_ADMIN} = '/common/oracle/env';
}
use DBI;
$dbh = DBI->connect('','scmuser/scmuser@itopstst','','Oracle');
die $DBI::errstr unless defined $dbh;
...which still doesn't work.
Anyone know what I'm doing wrong?
Thanks,
Shendal
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.