Ajay,

Keep in mind your environment from your web browser is considerably
different from the one on the command line.  The user is typically "nobody",
a seriously unprivileged user.  Try setting the LD_LIBRARY_PATH variable
inside the cgi script. 

Regards, 
Drew

-----Original Message-----
From: Ajay Madan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 07, 2001 9:24 AM
To: DBI Mailing List
Subject: install_driver(Oracle) error when CGI pgm called by Webserver


Hi,

        I have a CGI program written to connect to Database and
execute/fetch data for the
SQL - "Select tname from tab". It is a very simple program, which when
executed from
command line works fine, but when I give a input on the HTML Form and when
the same
cgi is being called by the WebServer I get the following error:
---------------------------------------------------------------------------
install_driver(Oracle) failed: [Wed Jun 6 13:08:16 2001] order.cgi: [Wed Jun
6 13:08:16 2001]
order.cgi: Can't load
'/usr/local/lib/perl5/site_perl/i86pc-solaris/auto/DBD/Oracle/Oracle.so' for
module DBD::Oracle:
ld.so.1: /usr/local/bin/perl: fatal: libclntsh.so.1.0: open failed: No such
file or directory at
/usr/local/lib/perl5/i86pc-solaris/5.00404/DynaLoader.pm line 166. [Wed Jun
6 13:08:16 2001]
order.cgi: [Wed Jun 6 13:08:16 2001] order.cgi: [Wed Jun 6 13:08:16 2001]
order.cgi: [Wed Jun 6
13:08:16 2001] order.cgi: at (eval 2) line 2 Perhaps a required shared
library or dll isn't
installed where expected at /export/home/ajay/apache/cgi-bin/order.cgi line
17
---------------------------------------------------------------------------

Mind you, I have set the LD_LIBRARY_PATH environment variable to Oracle
Home/Lib.

The following is the code of my cgi:

#!/usr/local/bin/perl

($field_name, $orderid) = split (/=/, $ENV {'QUERY_STRING'});

#$user_name =~ s/\+/" "/eg;

#$position=index($user_name,"&");
#$user_name=substr($user_name, 0, $position);

use DBI;
use CGI::Carp qw(fatalsToBrowser);

#use strict;

$dbuser = $ENV{ORACLE_USERID} || 's1_gwy/s1_gwy01';

$dbh = DBI->connect('DBI:Oracle:', $dbuser, '')
                or die "Couldnt connect to database: " . DBI->errstr;
$sth = $dbh->prepare('SELECT TNAME FROM TAB')
                or die "Couldnt prepare statement: " . $dbh->{RaiseError
};

$sth->execute or die "Couldnt execute statement: " . $sth->errstr;

my @data;

while (@data = $sth->fetchrow_array()) {
                                my $tname = $data[0];
                                print "\t$tname \n";
                              }

                              if ($sth->rows == 0) {
                                print "No names matched .\n\n";
                              }
$sth->finish;
$dbh->disconnect;

print "Content-type: text/html", "\n\n";
print "Content-type: text/html\n\n";
print "<HTML>\n<HEAD>\n<TITLE>Registration Results</TITLE>\n</HEAD>\n";
print "<BODY>\n";
print "<P><FONT SIZE=5>Hey, ", $tname, ", thanks for registering!</FONT>
</P>";
print "</BODY>\n</HTML>";

The Environment variables are set as below:

PATH=/usr/bin:/usr/local/bin:/usr/ccs/bin:/export/home/app/oracle/product/8.
0.5/bin
LD_LIBRARY_PATH=/usr/local/lib:/export/home/app/oracle/product/8.0.5/lib
TWO_TASK=sqadb_s1gwy
ORACLE_HOME=/export/home/app/oracle/product/8.0.5

System Information

DBI 1.18 - Upgraded from 1.15 and rebuilt DBD::Oracle
DBD 1.06
Sun OS 5.6
Perl 5.004_04

Need your help in solving this error,

Thanks in advance for the help,

Ajay

Reply via email to