Win32 ADO Connection not closing?

maxx at easynews.com maxx at easynews.com
Thu Jul 12 20:33:49 EDT 2001


In the code example below, an ADO connection to a MS SQL Server database is not
closing. Even after the 'adoConn.Close()' statement, the SQL Server still has an
open connection to the database. The connection does release after the script
terminates.

As part of the function of the script, I need it to release connections to the
database, before continuing.

Is there a way to explicitly destroy the adoConn object in the following example
?

adoConn = win32com.client.Dispatch('ADODB.Connection')
connect = "Provider=SQLOLEDB.1;Data Source=%s;Initial Catalog=%s;User
ID=sa;Password=;" % (server, dbname)
adoConn.Open(connect)
sql = "SELECT * FROM table1"
rs = adoConn.Execute(sql)
rs[0].Close()
adoConn.Close()




More information about the Python-list mailing list