The source code of DBviaODBC.pl : # To be run at a command prompt on a PC using the command: # perl DBviaODBC.pl # Connects to a database associated with a nominated DSN # (Data Source Name = symbolic name set up for a database) configured # into the ODBC Control Panel on the current Windows machine. # (Could be an Access database, local Oracle database, or other options.) # 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 variable $dsn # to identify the actual database. # # Author: SB Jones June 2001, based on R Bland use strict ; use DBI ; my ($dsn, # data source name configured in the ODBC control panel $dbh, # database handle $sth, # statement handle @row, # row (record) %attr, # error-checking attributes for DBI $ProxyID # machine, port, database ) ; my ($season, $title) ; $dsn = "<replace>"; # A DSN configured in the ODBC control panel $dbh = DBI->connect("dbi:ODBC:$dsn"); $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" ;