ipython-sql
ipython-sql copied to clipboard
Open connections after failure
I try to create a table with the magic which fails... The return is
__
If i use the following query
Select spid,hostname,hostprocess,program_name,nt_username, blocked, waittime, waittype, loginame,cmd,spid,waittype,waittime,lastwaittype,cpu,physical_io,memusage,login_time,last_batch,open_tran,status,net_address, t.text
from sys.sysprocesses sp
--JOIN sys.dm_exec_connections con ON con.session_id = sp.sid
CROSS APPLY( select text from sys.dm_exec_sql_text(sp.sql_handle))t
--where hostname
order by sp.spid
I see some open connections which seem to never close. One of them has the original create table statement, the other
IF @@TRANCOUNT > 0 COMMIT TRAN
I guess my question just is:
- how can you close a connection?
- how can you force the connection to close after each request?