I am also attaching the test2-cgi script
#!/usr/bin/perl -w
#use strict;
use DBI;
use HTML::Template;
use CGI::Carp qw/fatalsToBrowser/;
my $connect = "DBI:Oracle:db1"; # Database server path
my $login = 'report'; # Database username
my $passwd = 'report'; # Database password
#my $cgi = new CGI_Lite;
#my %passedinput = $cgi->parse_form_data;
my ($dbh, $sth);
# *********************************************************************************
&openconnection;
$sql = "SELECT url,unique_registered,total_hits
FROM rptinfo
WHERE username='munikuntlar'
AND month='JAN'";
$sth = $dbh->prepare($sql);
$sth->execute;
while (($url,$unique_registered,$total_hits) = $sth->fetchrow()) {
my %row_data;
$row_data{url} =$url;
$row_data{unique_registered} =$unique_registered;
$row_data{total_hits} =$total_hits;
push(@unique_list, \%row_data);
}
$sth->finish;
&displayresults;
&closeconnection;
# *********************************************************************************
sub displayresults {
my $template = HTML::Template->new(filename => '../test/test.tmpl');
#$template = HTML::Template->new(filename => '../test/test.tmpl');
#$template->param('unique_list',[EMAIL PROTECTED]); # TMPL LOOP Topics
List
if ([EMAIL PROTECTED]) {
# TMPL LOOP FAQ List
$template->param('nounique_list','1');
} else {
$template->param('unique_list',[EMAIL PROTECTED]);
}
# send the obligatory Content-Type and print the template output
print "Content-Type: text/html\n\n", $template->output;
#print "Content-Type: text/html\n\n"; # send the
obligatory Content-Type
#print $template->output;
# print the template
}
sub openconnection {
$dbh = DBI->connect($connect,$login,$passwd,{RaiseError => 1, AutoCommit =>
1}) or die "Cannot connect to database";
}
sub closeconnection {
$sth->finish;
$dbh->disconnect;
}
Robert <[EMAIL PROTECTED]> wrote:
Hi list
At command line script test2-cgi works fine but when I try from the browser it is
giving the following error
DBI connect('db1','report',...) failed: Error while trying to retrieve text for error
ORA-12154 (DBD ERROR: OCIServerAttach) at /home/report/www/cgi-bin/test2-cgi line 72
I have complete ORACLE environment set, I can connect using sqlplus and also can run
tnsping the database without any issues at command prompt.
Anyone know how to fix this issue?.
Thanks in advance