#!/usr/bin/perl -w 
use DBI;   # database access
use strict; # enforce declaring of variable names
use CGI qw/:standard/; # use CGI modules

# set oracle environment
$ENV{'ORACLE_HOME'}="/opt/oracle/9.0.1";

#display header
print header();

print <<EOE
 <html><head><title></title></head><body>
EOE
;

# connect to the database
my $username = "swang";
my $password = "B00133069";
my $dbName = "TRCH";
my $dbh = DBI->connect("dbi:Oracle:$dbName", $username, $password)
        || die "ERROR: $DBI::errstr ";

# prepares a statement, executes it
my $sth = $dbh->prepare("select * from person");
$sth->execute();

my @row;
while ( @row = $sth->fetchrow_array ) {
   print "name->$row[0]\n";
 }

# finish statement
$sth->finish;

# disconnect
$dbh->disconnect();

# print the HTML
print<<EOE
</body></html>
EOE
;


