taioba has asked for the wisdom of the Perl Monks concerning the following question:
sub dbQuery { my ($queryStr) = @_; my $dbObject = DBI->connect("dbi:ODBC:driver=Microsoft Access Driv +er (*.mdb, *.accdb); dbq=$logHsh{dbPath}", {RaiseError => 1}) || errMsg("Cannot connect to database.\n$DBI::e +rrstr"); my $dbQuery = $dbObject->prepare($queryStr, {RaiseError => 1}) || +errMsg("Couldn't prepare querying statement.\n$DBI::errstr"); $dbQuery->execute || errMsg("Error fetching data.\n$DBI::errstr"); my %dbHsh; while (my ($hshKey, $hshRec) = $dbQuery->fetchrow_array) { $dbHsh{$hshKey} = $hshRec; } $dbObject->disconnect; return %dbHsh; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Connecting to OpenOffice Base
by grep (Monsignor) on Sep 10, 2008 at 00:51 UTC | |
Re: Connecting to OpenOffice Base
by Sagacity (Monk) on Sep 10, 2008 at 02:46 UTC |