Monks,
I'm currently developing a Perl/CGI app that uses an MS Access database. To connect to the database, I'm using the Win32::ODBC module (I'd rather use DBI, but right now I must use Win32::ODBC).
The problem:
The app breaks when I send an SQL statement to the database and it returns more than 246 records. No error message is sent out.
The Code:
my $sqlStatement = "SELECT * FROM databaseName ORDER BY ID";
# Making the database connection
my $dbh = new Win32::ODBC("User")
or die "Couldn't connect to database: " . DBI->errorstr;
if ($dbh->Sql($sqlStatement)){
print "SQL failed!.\n";
print "Error: " . $dbh->Error() . "\n";
$dbh->Close();
exit;
}
my @dates = ();
my %Data = ();
# Loop through the recordset, put the data into our array, then do wit
+h it as we please
while( $dbh->FetchRow() )
{ %Data = $dbh->DataHash();
push( @dates, $Data{myDateTime} );
}
# Say goodbye to the database
$dbh->Close();
What I have tried:
- Using this select statement works: "SELECT TOP 246 datetime FROM myDatabaseName ORDER BY ID".
- Taking %Data = $dbh->DataHash(); out of the while( $dbh->FetchRow() ){} loop works unless I call FetchRow more than 246 times.
- I've tried raising the maximum buffer size $dbh->SetMaxBufSize(3024000); with no success.
- If I neglect to call %Data = $dbh->DataHash(); then the while loop iterates the correct number of times.
Where I think the problem could lie:
- My own mistake that someone can hopefully point out
- A Win32::ODBC bug
- An MS Access bug
- A server setting preventing large database queries
- An MS Access setting preventing large database queries
Any help would be greatly appreciated.
-----------------------------------
Washizu
http://www.bengarvey.com
Corrected sql per author's req. - dvergin 2002-08-31