关于perl访问oracle数据库的问题 。指点阿。。。

关于perl访问oracle数据库的问题 。指点阿。。。


关于perl访问oracle数据库的问题
描述:
red hat linux AS4 ,安装了DBD-Oracle-1.19 , perl-DBI-1.32-5.i386.rpm

我从shell里可以成功执行http_ora.pl脚本,实现从oracle数据库读取数据,并平通过cgi生成页面.
但是,从http://MYHOST/cgi/http_ora.pl中访问后台就出现 :
需要装modperl吗?我http.conf用oracle用户或nobody用户都报下面的错


Compilation failed in require at http_ora.pl line 4.
BEGIN failed--compilation aborted at http_ora.pl line 4.
Can't load '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module
DBD::Oracle: libclntsh.so.9.0: cannot open shared object file: No such file or directory at
/usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230.

我ls -l Oracle.so 和 DynaLoader.pm 都有啊
ls -l /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/Oracle.so
-r-xr-xr-x 1 root root 365630 Apr 16 08:27 /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/Oracle.so
DBD::Oracle 不能用嘛?


*************************************************************************
#! /usr/bin/perl
use DBI;
use CGI qw ( :standard );
use DBD::Oracle;

$ENV{'ORACLE_HOME'} = '/u1/oracle/app/oracle/product/9.2.0';
$ENV{'LD_LIBRARY_PATH'} = '/u1/oracle/app/oracle/product/9.2.0/lib';

print header(), start_html("my perl");

my $database = "DBI:Oracle:mytns";
my $db_user = "scott";
my $db_password = "tiger";

my $dbh = DBI->connect($database,$db_user,$db_password);

my $sth = $dbh->prepare("select aa,bb from cc");
$sth->execute();
while (my @row = $sth->fetchrow_array()) {
print Tr(td( b($row[0]) ),
td( i($row[1]) )
);
}
$sth->finish();

$dbh->disconnect();
print '</table>', end_html();
说的是找不到libclntsh.so.9.0?
export LD_LIBRARY_PATH=/u1/oracle/app/oracle/product/9.2.0/libLD_LIBRARY_PATH


find /  -name   libclntsh.so.9.0
/u1/oracle/app/oracle/product/9.2.0/lib/libclntsh.so.9.0

我有export啊.


QUOTE:
原帖由 dbwyl 于 2007-4-19 13:48 发表
export LD_LIBRARY_PATH=/u1/oracle/app/oracle/product/9.2.0/libLD_LIBRARY_PATH


find /  -name   libclntsh.so.9.0
/u1/oracle/app/oracle/product/9.2.0/lib/libclntsh.so.9.0

我有export啊.

先确定你的export是在启动apache之前吗?是同一个用户吗?可能你的问题就出在这儿,换成修改/etc/ld.so.conf可能就ok了。
echo '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/' >> /etc/ld.so.conf; ldconfig

cat /etc/ld.so.conf
      include ld.so.conf.d/*.conf
      /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/

souce /u1/oracle/.bash_profile
启动apache,问题依旧.......

Can't load '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.9.0: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230.
at http_ora.pl line 4
Compilation failed in require at http_ora.pl line 4.
BEGIN failed--compilation aborted at http_ora.pl line 4.
谢谢


QUOTE:
原帖由 dbwyl 于 2007-4-19 14:45 发表
echo '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/' >> /etc/ld.so.conf; ldconfig

cat /etc/ld.so.conf
      include ld.so.conf.d/*.conf
      /usr/lib/perl5/si ...

不要把/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/
而是要把/u1/oracle/app/oracle/product/9.2.0/lib/
放在/etc/ld.so.conf中。
解决了.斑竹福瑞哈哥,风云使者,你太有才了!
这年月oracle dba也不好当阿,什么都得干. 我从oracle读取数据,用chart::lines画图.谢谢.

/u1/oracle/app/oracle/product/9.2.0/lib:
        libxdb.so -> libxdb.so
        liboraioser.so -> liboraioser.so
        libvdg.so -> libvdg.so
        libvppdc.so -> libvppdc.so
        libwtc9.so -> libwtc9.so
        libtracepls9.so -> libtracepls9.so
        libcorejava.so -> libcorejava.so
        libnjssl9.so -> libnjssl9.so
        libOsUtils.so -> libOsUtils.so
        libvdc.so -> libvdc.so
        libordim9.so -> libordim9.so
        libjmisc.so -> libjmisc.so
        libVdbJdbcExt.so -> libVdbJdbcExt.so
        liboraawt.so -> liboraawt.so
        libunwind.so.3 -> libunwind.so.3
        libheteroxa9.so -> libheteroxa9.so
        libheteroxa9_g.so -> libheteroxa9_g.so
        libocijdbc9.so -> libocijdbc9.so
        libnjni9.so -> libnjni9.so
        libclntsh.so.9.0 -> libclntsh.so.9.0
        libolapapi9.so -> libolapapi9.so
        libctxx9.so -> libctxx9.so

dba做成你这样,也忒累了。上cpan去download一个吧
请问我没有安装oracle客户端,是装的oracle instant client
lib路径是/usr/lib/oracle/10.2.0.4/client/lib/
install_driver(Oracle) failed: Can't load '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libocci.so.10.1: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230.

我在/etc/ld.so.conf已经加入了/usr/lib/oracle/10.2.0.4/client/lib/
还是不行,请问该如何解决?
http://bbs.chinaunix.net/viewthr ... &extra=page%3D1
自己解决了
上baidu死活找不到
google一搜就有,老外比国人强些,呵呵