You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
968 B
Perl

use Cwd;
use Win32::ODBC;
$DriverType = "Microsoft Access Driver (*.mdb)";
$DSN = "Email Contacts";
$Description = "Description=Email List and Contact Information";
$DataBase = "EmailContacts.mdb";
$dir = cwd();
if (Win32::ODBC::ConfigDSN(ODBC_ADD_DSN,
$DriverType,
("DSN=$DSN",
$Description,
"DBQ=$dir\\$DataBase",
"DEFAULTDIR=$dir",
"UID=", "PWD="))){
print "Successful configuration of $DSN!\n";
}
else{
print "Error Creating $DSN\n";
Win32::ODBC::DumpError();
die;
}
my $myDb = Win32::ODBC->new($DSN);
my $connection;
if (! $myDb){
print "Failed to Connect $DSN\n";
Win32::ODBC::DumpError();
die;
}else {
$connection = $myDb->Connection();
print "Successful Connection $connection, $DSN\n";
}
$myDb->Close();