Database connections in Web Services

  • Thread starter Thread starter Random
  • Start date Start date
R

Random

What is the best way to handle database connections within a Web Service?
I'd like to pool connections for optimum efficiency.
 
So long as you use the same connection parameters i.e. login etc. ado.net
connection pooling should handle that for you.
 
But how should I handle the instantiation of the SQLConnection object? In a
private variable seems right, but should I declare it using the New operator
there... or do that within my WebMethods?
 
Webservices by design should be stateless for maximum efficeincy. Open it
in your webmethod, use it and close it all within the method. Let the
connection pooling look after itself unless you are receiving problems..

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
 
Back
Top