Database connection caching
Skip Montanaro
skip at pobox.com
Fri Mar 18 11:40:26 EST 2005
Lorenzo> is there an alternative way of:
Lorenzo> - create a connection object
Lorenzo> - open the connection
Lorenzo> - close the connection
Lorenzo> every time one has to run a query.
Sure, create a Queue.Queue object and stuff a number of connections into
it. When you want a connection call the queue's .get() method. When you're
done with it .put() it back. This has the other nice feature that a program
with a large number of threads can't overwhelm your database.
Skip
More information about the Python-list
mailing list