1. If you want to query whether the connection is not released, you can use the query analyzer to connect to your database server and execute the following code:
Select * from Master. DBO. sysprocesses
Where spid> 50
And waittype = 0x0000
And waittime = 0
And status = 'sleeping'
And last_batch <dateadd (minute,-10, getdate ())
And login_time <dateadd (minute,-10, getdate ())
If there are many such processes, It means there are indeed many connections that have not been released (the above query shows that there have been no connections with any action for more than 10 minutes)
2. if the connection is not released, you can release the connection without changing the program. in SQL Server, create a job every 10 minutes. Execute the following code to regularly check and release the null connection:
Declare hcforeach cursor global
For
Select 'Kill '+ rtrim (spid) from Master. DBO. sysprocesses
Where spid> 50
And waittype = 0x0000
And waittime = 0
And status = 'sleeping'
And last_batch <dateadd (minute,-60, getdate ())
And login_time <dateadd (minute,-60, getdate ())
Exec sp_msforeach_worker '? '