mysql connection

Steve Holden steve at holdenweb.com
Fri Nov 18 08:55:44 EST 2005


Python_it wrote:
> How can I close more cursors at the END of my page,
> after execute some scripts/functions.
> 
> example:
> I use one DB connection and 5 cursor actions.
> 
> How can I close these connections/actions at the END of my page?
> 
> 
> cursor.close() ==> 5 times??
> db.close()
> 
If the five cursor actions are all performed on the same cursor then you 
only need one cursor.close().

Of course you may also need to delete (or otherwise make available for 
garbage collection) the results you have fetched with cursor.fetchall() 
and similar methods, but basically you just need to close each cursor 
you open once.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list