Disconnecting a SQL Connection from a WebService

J

John

I have Web Service with a SQL Connection and every time the web service runs it creates a new SQL Connection on the SQL Server.
How do I get it to use only 1 SQL connection or at least drop old connections?
 
A

Antoni Massó Mola

Do you close the connection when your .aspx is finished working with it?

John said:
I have Web Service with a SQL Connection and every time the web service
runs it creates a new SQL Connection on the SQL Server.
How do I get it to use only 1 SQL connection or at least drop old
connections?
 
J

John

Yes, I am closing and disposing of the SQL connection, after returning XML to the User. But I'm not disposing the rest of the webserver code, just the SQL Connection.
As soon as I drop the connection to the SQL Server, SQL Server should be logining out the user acccount. Is that a correct statement?
John
 
I

Ian Jones

John,

Not necessarily. .NET pools SQL connections and recycles them to improve
performance as far as I understand.

So when you close a connection, it may still stay connected to SQL Server
from the 'pool', ready for the next instance of the sql connection object.

http://msdn.microsoft.com/library/d...nectionpoolingforsqlservernetdataprovider.asp

Hope this helps

Ian
John said:
Yes, I am closing and disposing of the SQL connection, after returning XML
to the User. But I'm not disposing the rest of the webserver code, just the
SQL Connection.
As soon as I drop the connection to the SQL Server, SQL Server should be
logining out the user acccount. Is that a correct statement?
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top