![]() |
Web service with open db connection
Hi all
ASP.Net v2.0. I have a web service that holds an "open" OleDb connection in one of its session variables, when the session times out does this connection close, or does it only close when another request comes through after the timeout? Hope that makes sense. Thanks Kev |
RE: Web service with open db connection
Hi Kev,
From your description, you're using OleDb components to access database in ASP.NET 2.0 application. and you're wondering how to correctly open and dispose the connection objects in the application's lifecycle, correct? Based on my experience, in .net framework application which use ADO.NET component to access database, you do not need to manually cache the connection object since by default the .NET managed provider or underlying OLEdb provider will use connecction pool to manage all the connections. That means you do not need to manually open a connection object and keep it open (stored in Session or other global storage). The recommended pattern is open the connecction and close it as soon as you finish using it. The connection pool will help you cache and pooling the underlying physical connection to database and will improve performance when you frequently open ADO.NET connection to database. #ADO.Net connection pooling http://weblogs.asp.net/sjoseph/archi...23/395601.aspx #Connection Pooling and Connection Management http://www.dbazine.com/sql/sql-articles/charran2 #Get IT Done: How connection pooling can boost ADO.NET performance http://articles.techrepublic.com.com...1-5034285.html BTW, for webservice, session state is an ASP.NET specific feature that does not conform to webservice standard, if you do want to cache some global data, you can also consider using a static class member (such as a static hashtable variable in a public class). If you have any further questions or anything else wonder, please feel free to post here. Sincerely, Steven Cheng Microsoft MSDN Online Support Lead ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscripti...ult.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscripti...t/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. |
Re: Web service with open db connection
Thank you very much, that answers my query perfectly.
Kev "Steven Cheng[MSFT]" <stcheng@online.microsoft.com> wrote in message news:4kFpHMLrHHA.2304@TK2MSFTNGHUB02.phx.gbl... > Hi Kev, > > From your description, you're using OleDb components to access database in > ASP.NET 2.0 application. and you're wondering how to correctly open and > dispose the connection objects in the application's lifecycle, correct? > > Based on my experience, in .net framework application which use ADO.NET > component to access database, you do not need to manually cache the > connection object since by default the .NET managed provider or underlying > OLEdb provider will use connecction pool to manage all the connections. > That means you do not need to manually open a connection object and keep > it > open (stored in Session or other global storage). The recommended > pattern > is open the connecction and close it as soon as you finish using it. The > connection pool will help you cache and pooling the underlying physical > connection to database and will improve performance when you frequently > open ADO.NET connection to database. > > #ADO.Net connection pooling > http://weblogs.asp.net/sjoseph/archi...23/395601.aspx > > #Connection Pooling and Connection Management > http://www.dbazine.com/sql/sql-articles/charran2 > > #Get IT Done: How connection pooling can boost ADO.NET performance > http://articles.techrepublic.com.com...1-5034285.html > > BTW, for webservice, session state is an ASP.NET specific feature that > does > not conform to webservice standard, if you do want to cache some global > data, you can also consider using a static class member (such as a static > hashtable variable in a public class). > > If you have any further questions or anything else wonder, please feel > free > to post here. > > Sincerely, > > Steven Cheng > > Microsoft MSDN Online Support Lead > > > > ================================================== > > Get notification to my posts through email? Please refer to > http://msdn.microsoft.com/subscripti...ult.aspx#notif > ications. > > > > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues > where an initial response from the community or a Microsoft Support > Engineer within 1 business day is acceptable. Please note that each follow > up response may take approximately 2 business days as the support > professional working with you may need further investigation to reach the > most efficient resolution. The offering is not appropriate for situations > that require urgent, real-time or phone-based interactions or complex > project analysis and dump analysis issues. Issues of this nature are best > handled working with a dedicated Microsoft Support Engineer by contacting > Microsoft Customer Support Services (CSS) at > http://msdn.microsoft.com/subscripti...t/default.aspx. > > ================================================== > > > This posting is provided "AS IS" with no warranties, and confers no > rights. > > > > > > > |
Re: Web service with open db connection
You're welcome:)
Have a good day! Sincerely, Steven Cheng Microsoft MSDN Online Support Lead This posting is provided "AS IS" with no warranties, and confers no rights. |
| All times are GMT. The time now is 04:03 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.