[DB-SIG] how to know the connexion is closed

Bill Campbell bill at celestial.net
Tue Apr 25 01:12:32 CEST 2006


On Mon, Apr 24, 2006, Dieter Maurer wrote:
>William Dode wrote at 2006-4-22 18:53 +0000:
>>I search for a generic way (for psycopg, mysqldb, adodbapi) to
>>know that the connexion is closed
>
>I fear there is no generic way....

One could use something like:

try: cur = conn.cursor()
except: cur = None

I would think that attempting to get a cursor from a closed
connection would always raise an error.

Bill
--
INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

``Intellectually, teachers fall between education theorists and bright
cocker spaniels. (Probably closer to the education theorists. The AKC has
been doing wonders with spaniels.) If you think I'm kidding look at the
GREs for education majors, whose scores are the lowest of all fields, and
remember that these are the smart ones.'' -- http://www.FredOnEverything.net


More information about the DB-SIG mailing list