win32::odbc hasn't closed db connection since build 1604

Posted by doug.hamilton@honeywell.com on 2017-05-18 08:56

I've been having an issue for several years now with win32:odbc.

After opening a connection to an Access database, issuing the $db->Close(); command leaves the .ldb file behind.

Code Sample:

///////////////////////////////////////////////////

my $db;
my $count = 0;

while (!defined($keypress=ReadKey(-1)))
{
$db=new Win32::ODBC($DSN) or die "couldn't ODBC $DSN because ", Win32::ODBC::Error(), "\n";
$db->Close();
$count++;
print "Open - Close Count = $count\n";
}

///////////////////////////////////////////////////

The above code crashes after 64 passes through the loop, complaining that I have reached the maximum number of open connections.

This means that my $db->Close() command has not been executed successfully.

So, I started uninstalling and then reinstalling older versions of Perl. The problem went away with build 1604.

I was surprised to see that build 1800 used the same version of win32::odbc as build 1604, but exhibited this problem.

No version of Perl has worked correctly in this regard since build 1604, which is no longer supported.

Please advise.

Thanks.