List:MySQL and Perl« Previous MessageNext Message »
From:Jochen Wiedmann Date:July 21 2001 10:11am
Subject:Re: multiples statement handlers ($sth) together
View as plain text  
Robert Goff wrote:

>>Extending it a little bit (more DBI related than mysql-modules
>>now).  If I am running it in a multithreaded app (e.g. perl with threads),
>>How can I be sure that $DBI::errstr refers to my thread, or I
>>can't without flaging it before using?
>>
> 
> DBI is not thread safe. Any DBI handles that you create are valid only in
> the current thread.  You can't use a single DBI handle for multiple threads.


Thats not completely true. DBI can be compiled to be thread
safe, in which case it serializes operations. (This is *not*
the default and can *not* be enabled at run time.)

However, using one $dbh per thread is definitely
recommended. In particular with MySQL, where connect
and disconnect are extremely fast, compared to Oracle
and similar engines.

Thread
multiples statement handlers ($sth) togetherRaul Dias20 Jul
  • RE: multiples statement handlers ($sth) togetherRobert Goff20 Jul
    • Re: multiples statement handlers ($sth) togetherJochen Wiedmann21 Jul
      • RE: multiples statement handlers ($sth) togetherRobert Goff22 Jul
  • Re: multiples statement handlers ($sth) togetherJochen Wiedmann21 Jul
Re: multiples statement handlers ($sth) togetherRaul Dias21 Jul
  • RE: multiples statement handlers ($sth) togetherRobert Goff22 Jul
    • Re: multiples statement handlers ($sth) togetherJochen Wiedmann23 Jul
    • connection pool via connect_cachedRajeev Rumale26 Jul
    • Re: connection pool via connect_cachedJochen Wiedmann26 Jul
Re: multiples statement handlers ($sth) togetherRaul Dias24 Jul