use DBI;
use strict;
my $query=new CGI;
print $query->header();
print "<html><head><title>DBI demo</title></head><body><h1>DBI/DBD Test</h1>\n";
my $dbh = DBI->connect( 'dbi:Oracle:YOUR-DATABASE-NAME',
'username', 'password', { RaiseError => 1, AutoCommit => 0 }
) || die "Database connection not made: $DBI::errstr";
my $sql = qq{ SELECT * FROM YOUR-TABLE };
my $sth = $dbh->prepare( $sql );
$sth->execute();
my( $name);
$sth->bind_columns( \$name, undef, undef );
while( $sth->fetch() ) {
print "$name <br>\n";
}
$sth->finish();
$dbh->disconnect();
print "<body></html>";
|