The source code of DBviaProxy.pl :
# To be run at a command prompt using the command:
# perl DBviaProxy.pl
# Connects to a nominated Oracle database via the Proxy Server
# at oracle.cs.stir.ac.uk
# Does a demo of table_info (see page 145 of Decartes and Bunce)
# and then does a straightforward retrieval from table Panto.
# (Note: The proxy cannot process the table_info query at present,
# so it's commented out.)
#
# 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
$ProxyID # machine, port, database
) ;
my ($season, $title) ;
# Configuration data
$dbname = "" ; # Replace with, eg, "ora1a11" or "CS"
$username = "" ; # Replace with, eg, "abc001"
$password = "" ; # Replace with, eg, "all4s9n"
%attr = (
PrintError => 0, # don't report errors through warn()
RaiseError => 1) ; # do report errors through die()
$ProxyID="hostname=oracle.cs.stir.ac.uk;port=57005;dsn=dbi:Oracle:$dbname";
$dbh = DBI->connect("dbi:Proxy:$ProxyID", $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";