http://www.perlmonks.org?node_id=998446


in reply to Using a single database handle or multiple handles

Depends on the database. For most, a single handle is preferable.

Microsoft SQL Server (and presumably Sybase too), when connected to using the TDS libraries does not allow multiple concurrent queries to execute on the same handle. You need to finish one query before making another. Thus patterns where you do:

my $results = $dbh->someQuery; while (my $row = $results->fetchrow_array) { $dbh->someOtherQuery; }

will not work unless you open a second connection. (I think some newer versions of TDS do actually emulate concurrent queries by transparently opening a second connection when required.)

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'