database-connection

Python Database connection Close

Python Database connection Close Question: Using the code below leaves me with an open connection, how do I close? import pyodbc conn = pyodbc.connect(‘DRIVER=MySQL ODBC 5.1 driver;SERVER=localhost;DATABASE=spt;UID=who;PWD=testest’) csr = conn.cursor() csr.close() del csr Asked By: Merlin || Source Answers: Connections have a close method as specified in PEP-249 (Python Database API Specification v2.0): import pyodbc …

Total answers: 6