LJ Archive

Listing 1. Perl/TK Script to Display Results

#!/usr/bin/perl -w
use DBI;
use Tk;
my $mw = MainWindow->new;
$mw->title("Oracle Datafiles");
$mw->Button
(-text => "Exit",
-command => sub { exit })->pack(-side => 'bottom');
$lb = $mw->Listbox
(-selectmode => "single", -width => 48)->pack();
$dbh = DBI->connect('ORA1,'ADMIN','ADMINPASS','Oracle');
$sth = $dbh->prepare
("select file_name from dba_data_files");
$sth->execute;
while (@row = $sth->fetchrow()) {
$lb->insert('end', @row);
}
$sth->finish;
$dbh->disconnect;
MainLoop;
exit;
LJ Archive