Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DBI Threaded use access?

16 views
Skip to first unread message

Jack Craig

unread,
Oct 10, 2012, 4:21:34 PM10/10/12
to dbi-...@perl.org
Hi DBI-Users,

I have a simple Perl program to open a file, db, serially read file, write
file records to db, close db, close file.

if, between the db open & close, given a single dbh, i create multiple
threads, each
reading a segment of the file and asynchronously writing to db using the
same dbh,
is that ok?

TIA, jackc...

Chris Buxton

unread,
Oct 10, 2012, 9:32:54 PM10/10/12
to Jack Craig, dbi-...@perl.org
No. Each thread needs its own dbh. Your DBD may not support this.

Chris Buxton
BlueCat Networks

Chris Buxton

unread,
Oct 11, 2012, 11:31:51 AM10/11/12
to Tim Bunce, Jack Craig, dbi-...@perl.org

On Oct 11, 2012, at 8:15 AM, Tim Bunce wrote:
> Specifically, http://search.cpan.org/~timb/DBI-1.622/DBI.pm#Threads_and_Thread_Safety

Another possibly useful resource on this topic can be found here:

http://search.cpan.org/~darnold/DBIx-Threaded-0.10/lib/DBIx/Threaded.pm

Looks good for DBDs that aren't reentrant. I haven't tried it myself.

Chris Buxton
BlueCat Networks
0 new messages