#!/usr/local/bin/perl5 -w

use CGI qw(:standard);
use DBI;
use DBI::DBD;

$ENV{'ORACLE_HOME'} = '/opt5/oracle8i/app';

my $dbh = DBI->connect("dbi:Oracle:db00",'your account','your password')
	or die "Can't connect to Oracle database";

my $statement = $dbh->prepare("select * from test")
	or die "Can't prepare SQL statment: $DBI::errstr\n";
	
$statement->execute
	or die "Can't execute SQL statment: $DBI::errstr\n";
	
print header();

print qq(<html>
		<head>
		<meta http-equiv="Content-Language" content="en-us">
		<meta http-equiv="Content-Type" content="text/html; charset=big5">
		<title>Test page</title>
		</head>
		<body>
		<p>This is a table</p>
		<table border="1" cellpadding="2" cellspacing="4" width="50%">
		<tr>
		<th width="25%">field1</th>
		<th width="25%">field2</th>
		<th width="25%">field3</th>
		<th width="25%">field4</th>
		</tr>);


my @row;
while (@row = $statement->fetchrow_array()) {
	print qq (<tr>
		<td width="25%">$row[0]</td>
		<td width="25%">$row[1]</td>
		<td width="25%">$row[2]</td>
		<td width="25%">$row[3]</td>
		</tr>);
}

print qq(</table>
		</body>
		</html>);

$statement->finish;
$dbh->disconnect or warn "Error disconnecting\n";

exit(0);
