Hi,
I am doing a project with Perl and oracle 9i..I m working on Red Hat8 and have a problem. PLS help me.
This script gets executed successfully in the terminal(i have attached the output below) but when the script is run thru the browser it returns an error. The parameters ORACLE_HOME and NLS_LANG are set as "/opt/ora9/product/9.2" and "AMERICAN" resp.
This is the script:
#! /usr/bin/perl
print "Content-type: text/html", "\n\n";
print "<HTML>", "\n";
print "<HEAD>";
print "<TITLE> Testing Team List<TITLE>", "\n";
print "</HEAD>", "\n";
print "<BODY>";
use CGI::Carp qw(fatalsToBrowser);
use DBI;
use strict;
my $dbh = DBI->connect('dbi:Oracle:','scott','tiger',{RaiseError => 1,AutoCommit => 0}) || die "Database connection not made:$DBI::errstr";
my $sql = qq{select name from project};
my $sth = $dbh->prepare( $sql );
$sth->execute();
my( $name, $i, $nnn);
$sth->bind_columns( undef, \$name );
while( $sth->fetch() ) {
$nnn=$name;
print " $nnn\n";
}
$sth->finish();
$dbh->disconnect();
print "\n", "</BODY>", "\n\n";
print "</HTML>", "\n\n";
#end index.pl
This is the Output in the Terminal

which is executing fine and the results are correct)
[oracle@localhost cgi-bin]$ perl index.pl
Content-type: text/html
<HTML>
<HEAD><TITLE> Testing Team List </TITLE>
</HEAD>
<BODY> name1
name2
name3
name4
name5
name6
name7
name8
name9
name10
</BODY>
</HTML>
[oracle@localhost cgi-bin]$
This is the error from the Browser

I am using Mozilla which comes with Red hat 8)
Content-type: text/html
Software error:
DBI connect('','scott',...) failed: (UNKNOWN OCI STATUS 1804) OCIInitialize. Check ORACLE_HOME and NLS settings etc. at /var/www/cgi-bin/index.pl line 12
For help, please send mail to the webmaster (root@localhost), giving this error message and the time and date of the error.
---------------
The NLS_LANG parameter is set to "AMERICAN".
and the Oracle_Home is also correct
This is .bashrc:
# .bashrc
# User specific aliases and functions
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export ORACLE_BASE=/opt/ora9
export ORACLE_HOME=/opt/ora9/product/9.2
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
export ORACLE_OWNER=oracle
export ORACLE_SID=ora9i
export ORACLE_TERM=xterm
export LD_ASSUME_KERNEL=2.4.1
export THREADS_FLAG=native
export LD_LIBRARY_PATH=/opt/ora9/product/9.2/lib:$LD_LIBRARY_PATH
export PATH=/opt/ora9/product/9.2/bin:$PATH
export NLS_LANG=AMERICAN;
PLS help me ....
Thanks in advance,
Pradeep.