#!/usr/bin/perl -w use strict; #Make sure you always use strict! use DBI; #This implements the DBI.pm # Connect to the Access database called 'db1.mdb' my $DSN = 'driver=Microsoft Access Driver (*.mdb);dbq=db1.mdb'; my $dbh = DBI->connect("dbi:ODBC:$DSN") || die "Couldn't open database: $DBI::errstr; stopped"; # Prepare the SQL query for execution # From the TEST_TBL return all values for FIELD1,FIELD2,FIELD3 my $SQL1 = $dbh->prepare(<execute() || die "Couldn't execute statement: $DBI::errstr; stopped"; # Fetch each row and print it while ( my ($field1, $field2, $field3) = $SQL1->fetchrow_array() ) { print "Found: $field1 - $field2 - $field3"; } # Disconnect from the database $dbh->disconnect();