<pre name="code" class="sql">use Tk;
use strict;
use DBI;
# Main Window
my $mw = new MainWindow;
my $but1 = $mw -> Button(-text => "view cpu",-width=>80,
-command =>\&push_button);
$but1 -> pack();

my $but2 = $mw -> Button(-text => "view memory",-width=>80);

$but2 -> pack();

my $but3 = $mw -> Button(-text => "view disk",-width=>80);

$but3 -> pack();

my $but3 = $mw -> Button(-text => "view Event",-width=>80);

$but3 -> pack();
MainLoop;

#This is executed when the button is pressed
sub push_button {
system("cls");
my $dbName = 'june';
my $dbUser = 'test';
my $dbUserPass = 'test';
my $dbh = DBI->connect("dbi:Oracle:$dbName", $dbUser, $dbUserPass) or die "can't connect to database "

;
my $hostSql = qq{select table_name,tablespace_name,status from user_tables};


my ($table_name, $tablespace_name, $status);
my $selStmt = $dbh->prepare($hostSql);
$selStmt->bind_columns(undef, \$table_name, \$tablespace_name, \$status);
$selStmt->execute();
while( $selStmt->fetch() ){
print "$table_name\t\t $tablespace_name\t\t$status\n";
}
$selStmt->finish;
$dbh->disconnect;
}