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 -> Re: Oracle from the Web using PERL

Re: Oracle from the Web using PERL

From: John D Groenveld <groenvel_at_cse.psu.edu>
Date: 10 Apr 1999 14:06:30 -0400
Message-ID: <7eo3v6$b1d$1@tholian.cse.psu.edu>


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

Original text of this message

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