Hi,
I'm looking to have an SQL server, which won't be accessed directly, but
rather through web services. However, since web services are stateless, I
guess I'd have to open and close the connection on each call, which seems
rather time consuming.
I'm assuming I'd need to have a static variable which would contain a
pointer to my connection. Is that the way to go or is there another way to do
this?
Keenan Newton - 16 Feb 2005 20:48 GMT
Actually the opening and closing of a connection to Sql Server is very
inexpensive. In reality .Net manages your connection ina connection
pool. As long as your connection string is the same,a nd you are using
the same identity it will re-use that connection over and over. So in
reality when you close a connection your not really closing it but
returning it bacl to the connection pool.
The MSDN link below explains it in more detail:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conConnectionPoolingForSQLServerNETDataProvider.asp
Phil Greg - 16 Feb 2005 20:55 GMT
Actually, I made a mistake, I'm using MSDE. Does that still work?
> Actually the opening and closing of a connection to Sql Server is very
> inexpensive. In reality .Net manages your connection ina connection
[quoted text clipped - 6 lines]
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conConnectionPoolingForSQLServerNETDataProvider.asp
Keenan Newton - 16 Feb 2005 22:40 GMT
Should as it is .Net handling the connections