Database connection caching
skip at pobox.com
Fri Mar 18 17:40:26 CET 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.
More information about the Python-list