[Tutor] The case of the missing close

Robert, Andrew ARobert at MFS.com
Wed Dec 1 11:05:24 CET 2004

Hi Kent,

I tried returning the connection but that didn't work either.

In fact, returning the connection fails to create the cursor object in the calling program and the whole program dies a miserable death.

I am intrigued about the idea of a class though.

I've never really had the need to use them before now but it seems like now is a good time to start.

I'll let you know how things work out.

-----Original Message-----
From: tutor-bounces at python.org on behalf of Kent Johnson
Sent: Tue 11/30/2004 10:21 PM
Cc: tutor at python.org
Subject: Re: [Tutor] The case of the missing close
I don't know cx_Oracle, but my guess is you want to close the actual connection object, not the 
cursor. Your dbopen() function doesn't expose the connection.

One option would be to return the connection rather than the cursor. Then clients could close the 
connection when done. Another option is to create a class that holds both the connection and the 
cursor, then you can have close() on the class actually close the connection.


"MFS Relay Service" made the following
 annotations on 12/01/2004 05:15:44 AM
This email communication and any attachments may contain proprietary, confidential, or privileged information.  If you are not the intended recipient, you are hereby notified that you have received this email in error and that any review, disclosure, dissemination, distribution or copying of it or its contents is prohibited.  The sender does not waive confidentiality or any privilege by mistransmission.  If you have received this email in error, please notify the sender immediately, delete this email, and destroy all copies and any attachments.

More information about the Tutor mailing list