Database connection caching

Simon Brunning simon.brunning at gmail.com
Fri Mar 18 17:45:38 CET 2005


On 18 Mar 2005 04:52:03 -0800, lbolognini at gmail.com
<lbolognini at gmail.com> wrote:
> is there an alternative way of:
> 
> - create a connection object
> - open the connection
> - close the connection
> 
> every time one has to run a query.

It's actually morte like:

create connection
create cursor
execute SQL
process cursor
close cursor
close connection

The bit that you can avoid it the creation of the connection - that's
an intensive process. If your system is single threaded, or if it's a
very small app, you can just create a single open connection and keep
using that. I usually find that I need a pool of open connections,
though.

-- 
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list