MySQL Forums
Forum List  »  Connector/Python

Python thread insertion with MySQL
Posted by: Mike Ng
Date: March 17, 2005 03:29PM

Hi all,

I created a python application that uses about 20 threads to process insertion into MySql. However, when I allowed the threads to do inserts into the db without lock/unlock, MySql gives me an operational error with code 1045. I can't figure out why this is so?? The application declares a global db connection and is passed along to all the threads for processing. This way, I believe there is only one active connection rather than multiple connections.
On the other hand, if I used a lock/unlock mechanism for the db inserts for all threads, I do not get this error.

Am I flawed in creating a global db connections and they conflict somehow? Should I create 20 db connections. I would think the problem is not with the thread conflict, since I am just inserting new records into the database and they are not overwriting each others.

Any feedback would be appreciated.


Options: ReplyQuote

Written By
Python thread insertion with MySQL
March 17, 2005 03:29PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.