Hi, all.

I use ActivePerl 5.8.8.817. The latest Class::DBI::MSSQL, DBD::ODBC on Win2000 sp4, connecting to MS SQL Server 2000.

The following code:
use strict; use warnings; use XML::Simple; use Probe::ProbeUser; #uses base 'Class::DBI::MSSQL' use threads; my $config = XMLin('./probe.xml', ForceArray => 1); while (my ($type_name, $user_type) = each %{$config->{user}}) { for (my $i = 0; $i < $user_type->{quantity}; $i++) { threads->create( sub { my $user = Probe::ProbeUser->create( { pu_login => $user_type->{login}, pu_paswd => $user_type->{password}, pu_type => $type_name, } ); $user->execute(tasks => $user_type->{task}); } )->join(); } } __END__
produces:

Thread failed to start: Can't insert new Probe::ProbeUser: DBD::ODBC::db FETCH failed: handle 2 is owned by thread 15d4924 not current thread 391429c (handles can't be shared between threads and your driver may need a CLONE method added) at c:/Perl/site/lib/Ima/DBI.pm line 312. at ./probe.pl line 31 Scalars leaked: 4

I didn't find anything on how to overcome this. Could anyone help?

Thanks,
Artem A. Avetisyan.

P.S.
The driver does have CLONE method.

In reply to dbi & threads by artemave

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.