Re: Best connection management
- From: Hornet77 <neuro@xxxxxxxxxx>
- Date: Fri, 07 Sep 2007 15:09:18 +0200
Miha Markic ha scritto:
so the best solution is always open and close connection for every operation on database? I know that open connection is an expensive operation, so If I need to open and close for every query I have to do can I produce a performance problem?
Not at all. (physicall) connection pooling is working behind the scenes. Performance hit is neglible.
In your case, you have a serious problem - you use a single connection instance (not thread safe) in a multithreaded app (which asp.net is).
I use lock statements to avoid this problem.... Am I wrong?
Yes, you are killing performances. Otherwise not.
All my 3 modules works in a multithread environment so.... if I have in my "dbManager" class a single SqlConnection instance to open and close for every operation could be a good solution? or I need to use a new instance in every "dbManager" method?
Thanks
.
- Follow-Ups:
- Re: Best connection management
- From: Robbe Morris - [MVP] C#
- Re: Best connection management
- References:
- Best connection management
- From: Hornet77
- Re: Best connection management
- From: Miha Markic
- Re: Best connection management
- From: Hornet77
- Re: Best connection management
- From: Miha Markic
- Best connection management
- Prev by Date: Re: Best connection management
- Next by Date: corruption updating a NCLOB field with ODP.Net
- Previous by thread: Re: Best connection management
- Next by thread: Re: Best connection management
- Index(es):
Relevant Pages
|