in reply to Using MS Access via DBI and DBD::ODBC

What if you create a dsn through Control Panel/ODBC Data Sources? The user/password can be configured there, so that your program does not need it.
  • Comment on Re: Using MS Access via DBI and DBD::ODBC

Replies are listed 'Best First'.
Re^2: Using MS Access via DBI and DBD::ODBC
by reneeb (Chaplain) on Jul 15, 2005 at 14:13 UTC
    Sorry for that late answer, but I was ill the last three weeks.

    I've solved the problem! I want to post the solution:

    You have to change the $dsn-String. The path to the .mdw-file has to be added with the key "SystemDB":
    #! /usr/bin/perl use strict; use warnings; use DBI; my $user = 'username'; my $pass = 'password'; my $dsn = 'driver=Microsoft Access-Treiber (*.mdb); '; $dsn .= 'dbq=db1.mdb; SystemDB=c:\path\to\file.mdw'; # to add the SystemDB-key is the solution! my $dbh = DBI->connect("DBI:ODBC:$dsn",$user,$pass) or die $DBI::errstr; [...]