|
Hi all,
I am working on a site using Cherrypy 2.1.1, and using psycopg2.0b8 to connect to a PostgreSQL 8.1 database.
ah, and python 2.4, of course...
Actually, I have two questions:
1. What is the "right" way to handle my connections to the database? Should I create a new connection for each session/thread, or create only one connection for the server, and let psycopg handle the threads?
2. Since it seemed more reasonable to me that I should only create one connection, I tried to check what happens when different threads try executing queries at the same time. The result was catastrophic. Other threads interrupt between the query is made and the results fetched, and not one of them succeeds...
How can I lock the cursor for the between the executing a fetching, so other threads won't interfere?
Or do you have a better idea for the whole situation?
Thanks, (and excuse me for my ignorance...)
Saar.
_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/+sw@xxxxxxxxxxxxxxxx
http://lists.initd.org/mailman/listinfo/psycopg
|