Re: Newing a static var?
- From: "Joanna Carter [TeamB]" <joanna@xxxxxxxxxxxx>
- Date: Wed, 19 Apr 2006 09:03:30 +0100
<wfairl@xxxxxxxxx> a écrit dans le message de news:
1145400263.520082.202460@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
| Yes, close it when the app closes but in that case the pool would be
| gone anyway and when you restart the app you'll have a new pool. You
| won't notice the difference in performance between using a connection
| pool ("newing" a connection object everytime) and your static
| connection object. Also, as I mentioned before, the connection pool
| scales perfectly and works perfectly in a multi-threaded environment.
| It's not just multi-threading you need to worry about though, what
| would you do in the situation where you needed two connections on the
| same thread (Maybe while looping through a datareader and you want to
| do an update or lookup)?
So are we saying that it is actually more efficient to create a new
connection every time you want to touch the database, rather than use the
MARS to allow multiple queries in the same transaction ?
I have a scenario where I store an object that contains nested objects. I
want to store everything in the context of a single transaction; if one part
fails the whole transaction should rollback. I found that this seems to
require using MARS to allow the multiple queries involved.
Or are we saying that I would need MARS within the context of opening a new
connection for every transaction ?
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer
.
- References:
- Newing a static var?
- From: Brett Romero
- Re: Newing a static var?
- From: Brett Romero
- Re: Newing a static var?
- From: wfairl
- Re: Newing a static var?
- From: Brett Romero
- Re: Newing a static var?
- From: wfairl
- Re: Newing a static var?
- From: Brett Romero
- Re: Newing a static var?
- From: wfairl
- Newing a static var?
- Prev by Date: text into checkedListBox
- Next by Date: Re: Thread - CPU usage
- Previous by thread: Re: Newing a static var?
- Next by thread: Re: Newing a static var?
- Index(es):
Relevant Pages
|
Loading