Sqlconnection not close in multithreading environment

  • Thread starter Thread starter Clement
  • Start date Start date
C

Clement

Hi,
i had develope asp.net using the webservice as the input point for
processing. in the webservice, i had use the threading process the request.
this is very data intensive process using sql server 2000 standard edition
in the production server with .Net framework 1.0 SP2.

i notice that when i run the test in production, the sqlconnection doesn't
close even though i do have the sqlconnection.close in every statement i
have in the Try...catch...finally block. but if i run in my development
server, i can see sqlconnection is close every time after the sql statement
.. anyone out there have any idea ?
Note: i use the sql profiler to monitor the sql activity in the same
database with is calling by development server and production server.
development server have dotnet framework 1.0 SP2 and 1.1 installed.
 
When you close a connection with the SqlConnection object
the connection is released but it will still be open on
the server beacuse of the connection pooling support.

If you should always need to open a new connection on the
sql server it will affect performance badly.

To read more about the connection pooling and how it work
please go to:

http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpguide/html/cpconconnectionpoolingforsqlservernetdatap
rovider.asp

/Fredrik Normén NSQAURED2
http://www.nsqaured2.net
 
thanks!! yes, i do have read thise article before i start. i had follow the
way as they desribe. it was worling fine if i running in debuger mode. the
connection is open then close immediate after each statement

When you close a connection with the SqlConnection object
the connection is released but it will still be open on
the server beacuse of the connection pooling support.

If you should always need to open a new connection on the
sql server it will affect performance badly.

To read more about the connection pooling and how it work
please go to:

http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpguide/html/cpconconnectionpoolingforsqlservernetdatap
rovider.asp

/Fredrik Normén NSQAURED2
http://www.nsqaured2.net
 
Back
Top