mysqldb + multi-threading

hg hg at nospam.com
Sat Sep 9 16:46:12 CEST 2006


hg wrote:
> Hi,
> 
> I am writing a transaction server (socket-based) under windows.
> 
> I use mysqldb to log info into MySQL.
> 
> It is all working and I need now to decide whether to use forks
> (CreateProcess I guess) or threads.
> 
> I saw in another thread that some db engines did have issues with being
> called from threads.
> 
> My gut feeling is to use threads (note: each transaction is finite, so
> the process/thread die fairly quickly).
> 
> Any insight ?
> 
> 
> hg

A thread on the mysqldb forum:

 By: Rob Steele - robsteele
  RE: Do I need to enable thread safe mysql lib
2002-10-18 11:35
Yup. You also need to either synchronize the reading and writing threads
so that only one can get at the database at a time or else open a second
connection. You should probably use sepearate connections, one for each
thread.

hg



More information about the Python-list mailing list