Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> absolute newbie: perl-cgi+oracle

absolute newbie: perl-cgi+oracle

From: Johny Tom Nishanth Alphonse <jta01_at_doc.ic.ac.uk>
Date: Thu, 26 Sep 2002 10:32:30 +0100
Message-ID: <Pine.LNX.4.42.0209261025330.29325-100000@moa.doc.ic.ac.uk>


Hello All,
I am a newbie and need help with this.
 I have written the following perl script which works fine:

###############################################################
#!/usr/bin/perl -w
use DBI;
my $dbh = DBI->connect('DBI:Oracle:oradb','Nishanth','Nishanth'); my $sth = $dbh->prepare('SELECT * FROM sequence where id_est = 8') || die "Couldn't prepare statement: " . $dbh->errstr;
$sth->execute();

while(@data = $sth->fetchrow_array()){
print "@data\n";
}
$sth->finish;
$dbh->disconnect;

exit(0);
################################################################

When I try to write a perl-cgi script for displaying the results in a html
page format, it doesn't work. So the following is the cgi script:

##################################################################
#!/usr/bin/perl -w
use DBI;
use CGI;
use CGI::Carp('fatalsToBrowser');
print "Content-type:text/html\n\n";
print <<EHTML;
<html>
<head>
<title>Sequence retriever</title>
</head>
<body>

EHTML
my $dbh =
DBI->connect('DBI:Oracle:oradb_at_localhost:1521','Nishanth','Nishanth') || die("Nope. Didn't make it\n");
my $sth = $dbh->prepare('SELECT * FROM sequence where id_est = 8');
$sth->execute();

while(@data = $sth->fetchrow_array()){
print "@data\n<br>";
}
$sth->finish;
$dbh->disconnect;

print <<EHTML;
</body>
</html>
EHTML
######################################################################
The script fails at the connect statement, because the die statement is shown on the browser window, i.e. I get the statement "Nope. Didn't make it" on the browser window.
Any ideas why this should be so?
Thanks,
A.Nishanth Received on Thu Sep 26 2002 - 04:32:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US