The source code of DBviaOracleClient.pl : # To be run at a command prompt using the command: # perl DBviaOracleClient.pl # Connects to a nominated Oracle database via the Oracle client # software which must be installed on the current machine. # Does a demo of table_info (see page 145 of Decartes and Bunce) # and then does a straightforward retrieval from table Panto. # # Customize the definitions below of variables # $dbname, $username and $password # with suitable strings to identify the actual database # and give authorization info. # # Author: SB Jones June 2001, based on R Bland use strict ; use DBI ; my ($dbname, # the database name $username,# for accessing the database $password,# for accessing the database $dbh, # database handle $sth, # statement handle %attr # error-checking attributes for DBI ) ; my ($season, $title) ; $dbname = "<replace>"; # Replace with, eg, ora1a11 or CS $username = "<replace>"; $password = "<replace>"; %attr = ( PrintError => 0, # don't report errors through warn() RaiseError => 1) ; # do report errors through die() $dbh = DBI->connect("dbi:Oracle:$dbname", $username, $password, \%attr) ; $sth = $dbh->table_info() ; while ( my ($qual, $owner, $name, $type, $remarks) = $sth->fetchrow_array()) { foreach ($qual, $owner, $name, $type, $remarks) { $_ = "N/A" unless defined $_ ; } printf "%-9s %-9s %-32s %-6s %s\n", $qual, $owner, $name, $type, $remarks } $sth = $dbh->prepare("SELECT DISTINCT Season, Title FROM Panto") ; $sth->execute ; while (($season, $title) = $sth->fetchrow_array()) { print "In $season the panto was $title\n" ; } $dbh->disconnect ; print "That's all\n" ;