I'm facing problem to access Oracle Data through Internet Browser
Using
Perl, Oracle9i, DBD::ORACLE
On
Linux 7.1
----------------------------------------------------------------------------------
This is Perl Code To Fetch data from Oracle9i Using DBD::ORACLE
and works FINE at Command Line
----------------------------------------------------------------------------------
#!/usr/bin/perl
use strict;
use DBI;
use warnings;
my $dbh = DBI->connect('dbi:Oracle:sunora', 'scott','tiger') || die "Not Connected";
print "Test Perl On Sun";
my $sql = qq{ SELECT empno, ename ,deptno , sal FROM emp};
my $sth = $dbh->prepare($sql);
$sth->execute();
my ($tname);
my ($tno);
my ($dept);
my ($sala);
$sth->bind_columns(undef, \$tno, \$tname ,\$dept ,\$sala);
print "List Of Employees:\n\n";
while($sth->fetch())
{
print "$tno $tname $dept $sala\n";
}
$sth->finish();
$dbh->disconnect;
------------------------------------------------------------------------------------
But when i generate CGI, It returns nothing.
-----------------------------------------------------------------------------------
#!/usr/bin/perl
use strict;
use DBI;
use CGI;
use warnings;
my $cg = new CGI;
print $cg->header();
print $cg->start_html("Welcome"
my $dbh = DBI->connect('dbi:Oracle:sunora',
'scott','tiger') || die "Not Connected";
print $cg->b("Hello Oracle"
my $sql = qq{ SELECT empno, ename ,deptno , sal FROM emp};
my $sth = $dbh->prepare($sql);
$sth->execute();
my ($tname);
my ($tno);
my ($dept);
my ($sala);
$sth->bind_columns(undef, \$tno, \$tname ,\$dept ,\$sala);
print $cg->b("List Of Employees"
while($sth->fetch())
{
print $cg->b("$tno $tname $dept $sala"
}
$sth->finish();
$dbh->disconnect;
print $cg->end_html();
-----------------------------------------------------------------------------------------