Why OleDbConnection.Close() does not close connection immediately?

S

Serg

I am using MSSQL2000+sp3 and Framework_1.1
In my application i do first temp connection to do some checks after that
disconnect temp connection and do normal connection. But after calling
OleDbConnection.Close() connection on sql server is not closed immediately.
Immediately after OleDbConnection.Close() I check OleDbConnection.State it
is closed.
But "select * from master..sysprocesses" returns to me that my connection in
sql server is still opened. It is disappeared from master..sysprocesses
after ~1 minute.

What shoud i do to get sql connection closed immediately?
In my aplication there is an algorithm that accesses master..sysprocesses
and do some checks. It is not working during the first minute.

Thanks in adv
Serg
 
S

Serg

i have tried to set Pooling='false' and Connection Lifetime=1
but it does not have any affect



Miha Markic said:
Hi Serg,

This behaviour is default for connection pooling.
Connection Pooling for the .NET Framework Data Provider for OLE DB
http://msdn.microsoft.com/library/d...cpconretrievingidentityorautonumbervalues.asp

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Serg said:
I am using MSSQL2000+sp3 and Framework_1.1
In my application i do first temp connection to do some checks after that
disconnect temp connection and do normal connection. But after calling
OleDbConnection.Close() connection on sql server is not closed
immediately.
Immediately after OleDbConnection.Close() I check OleDbConnection.State it
is closed.
But "select * from master..sysprocesses" returns to me that my connection
in
sql server is still opened. It is disappeared from master..sysprocesses
after ~1 minute.

What shoud i do to get sql connection closed immediately?
In my aplication there is an algorithm that accesses master..sysprocesses
and do some checks. It is not working during the first minute.

Thanks in adv
Serg
 
M

Miha Markic [MVP C#]

Hi Serg,

Today is not my day for posting links :-S.
The link should be:
http://msdn.microsoft.com/library/d...nConnectionPoolingForOLEDBNETDataProvider.asp
and you should pass
OLE DB Services=-4

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Serg said:
i have tried to set Pooling='false' and Connection Lifetime=1
but it does not have any affect



Miha Markic said:
Hi Serg,

This behaviour is default for connection pooling.
Connection Pooling for the .NET Framework Data Provider for OLE DB
http://msdn.microsoft.com/library/d...cpconretrievingidentityorautonumbervalues.asp

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Serg said:
I am using MSSQL2000+sp3 and Framework_1.1
In my application i do first temp connection to do some checks after that
disconnect temp connection and do normal connection. But after calling
OleDbConnection.Close() connection on sql server is not closed
immediately.
Immediately after OleDbConnection.Close() I check OleDbConnection.State it
is closed.
But "select * from master..sysprocesses" returns to me that my connection
in
sql server is still opened. It is disappeared from master..sysprocesses
after ~1 minute.

What shoud i do to get sql connection closed immediately?
In my aplication there is an algorithm that accesses master..sysprocesses
and do some checks. It is not working during the first minute.

Thanks in adv
Serg
 
S

Serg

Thanks.
It helps.


Miha Markic said:
Hi Serg,

Today is not my day for posting links :-S.
The link should be:
http://msdn.microsoft.com/library/d...nConnectionPoolingForOLEDBNETDataProvider.asp
and you should pass
OLE DB Services=-4

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Serg said:
i have tried to set Pooling='false' and Connection Lifetime=1
but it does not have any affect



Miha Markic said:
Hi Serg,

This behaviour is default for connection pooling.
Connection Pooling for the .NET Framework Data Provider for OLE DB
http://msdn.microsoft.com/library/d...cpconretrievingidentityorautonumbervalues.asp
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

I am using MSSQL2000+sp3 and Framework_1.1
In my application i do first temp connection to do some checks after that
disconnect temp connection and do normal connection. But after calling
OleDbConnection.Close() connection on sql server is not closed
immediately.
Immediately after OleDbConnection.Close() I check
OleDbConnection.State
it
is closed.
But "select * from master..sysprocesses" returns to me that my connection
in
sql server is still opened. It is disappeared from master..sysprocesses
after ~1 minute.

What shoud i do to get sql connection closed immediately?
In my aplication there is an algorithm that accesses master..sysprocesses
and do some checks. It is not working during the first minute.

Thanks in adv
Serg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top