On Oct 11, 2012, at 8:15 AM, Tim Bunce wrote: > On Wed, Oct 10, 2012 at 06:32:54PM -0700, Chris Buxton wrote: >> On Oct 10, 2012, at 1:21 PM, Jack Craig wrote: >> >>> 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? >> >> No. Each thread needs its own dbh. Your DBD may not support this. > > 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