On Mon, 19 Apr 2004 11:56:41 +0200, Bart Lateur wrote:

>On Mon, 19 Apr 2004 13:06:26 +1000 (EST), Dennis M. Gray wrote:
>
>>$dbh = DBI->connect('dbi:ODBC:driver=Microsoft Access Driver
>>(*.mdb);dbq=F:/GROUPS/BUSINESS/BSS/safeguards/systems/testing/safeguards_test.mdb')
>>      or die "Cannot connect to Safeguards Test database";
>
>I doubt that this ever worked... You need to use backslashes for the
>database path.

Oh, one more hint... I use rel2abs() from File::Spec::Functions to
convert a path into the format that the database driver likes. 

Here's the code, split into many statements for comprehensibility:

        $file =
'F:/GROUPS/BUSINESS/BSS/safeguards/systems/testing/safeguards_test.mdb';
        # or:
        # $file = "../data/mydb.mdb";
        use File::Spec::Functions 'rel2abs';
        my $dbq = rel2abs($file);
        -e $dbq or die "Database '$dbq' does not exist";
        my $dsn = "driver=Microsoft Access Driver (*.mdb);dbq=$dbq";
        my $dbh = DBI->connect("ddbi:ODBC:$dsn", "", "");

-- 
        Bart.

Reply via email to