google-code-export / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
1 stars 0 forks source link

__exit__ do not close connection properly #348

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
Say if I create a conn object using
with X.connect(*params) as conn:
    conn.autocommit = False
2.
It should properly lose the connection when I finish using it.
http://docs.python.org/release/2.5/whatsnew/pep-343.html
3.
I wrap the entire function with try/finally.
If I call conn.close(), no error is tossed.
Similar with conn.__exit__() and conn.close().
Note that calling conn.close() tosses an error.

What is the expected output? What do you see instead?
A connection getting closed, but not.

What version of the product are you using? On what operating system?
3.0.7
CentOS 5

Please provide any additional information below.
I am not using vanilla pyODBC, but with a wrapper around it. I hope it does not 
matter in this case.

Original issue reported on code.google.com by zzhml2...@hotmail.com on 18 Nov 2013 at 8:08