Hi all,

I thought I can hit a nice milestone today, but it seems that I have hit a strange obstacle instead. In my tests, the following code will run, but when it terminates an error message will be shown.
use strict;
use warnings;
use DBI;
use threads;

doIt();
doIt();

sub doIt
{
  my $dbh = DBI->connect('dbi:mysql:database','username','password');
  my $stmt = $dbh->prepare ('select id from tablename');
  $stmt->execute();
  while (my $record=$stmt->fetchrow_hashref('NAME_lc')) {}
}

Change the database connection parameters (eg. username, password, table name) to your database.

My analysis of the problem is as follows:
1. Using the ODBC driver is ok. I've tested with MSSQL connection and it's fine. 2. The problem lies with using threads alongside DBI. If I take out 'use threads' all is well. 3. There are 2x doIt() calls because it only fails on the second database connection. 4. It seems to be related to fetchrow_hashref(), because if I take that out, all is fine.

Can someone confirm this? Is there anybody who can suggest a workaround? Thanks.

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to