Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle from the Web using PERL
In article <370E4EFB.7658B721_at_lmtas.lmco.com>,
Michael Hill <l463520_at_lmtas.lmco.com> wrote:
>Does anyone have any experience accessing Oracle from the web using
>PERL?
Yes.
John
groenveld_at_acm.org
#!/usr/bin/perl -wT
use strict;
use CGI;
use DBI;
print CGI->header('text/html');
my $dbh = DBI->connect("dbi:Oracle:", "scott", "tiger")
or die "$DBI::err: $DBI::errstr\n";
my $sth = $dbh->prepare("SELECT SYSDATE FROM DUAL")
or die "$DBI::err: $DBI::errstr\n";
$sth->execute()
or die "$DBI::err: $DBI::errstr\n";
my $sysdate;
$sth->bind_col(1, \$sysdate)
or die "$DBI::err: $DBI::errstr\n";
while ($sth->fetch) {
die "$DBI::err: $DBI::errstr\n" if $DBI::err;
print $sysdate;
}
$sth->finish
or die "$DBI::err: $DBI::errstr\n";
$dbh->disconnect
or die "$DBI::err: $DBI::errstr\n"; Received on Sat Apr 10 1999 - 13:06:30 CDT
![]() |
![]() |