Re: Connection Pooling
- From: "George" <noemail@xxxxxxxxxxx>
- Date: Tue, 29 Jul 2008 22:50:44 -0400
In the object oriented world objects work with Database.
So it's common for 2 different objects to update it's own pieces of databases.
for example:
Let say you have a rule if person withdraws money from his checking account and do not have balance available the money is taken from his saving account.
So here is the pseducode.
clsAccount objChecking, objSaving;
.....
if( objChecking.AvailableBalance < NeededAmount )
{
objSavings.Take(NeededAmount);
objChecking.Put(NeededAmount);
}
objChecking.GiveCash(NeededAmount);
If the 'Put' method fails we need to reverse 'Take' action...
in a simple world (not object oriented) you would issue DBConnection.AbortTransaction and it will be like the method 'Take' never happened.
But in object oriented world, each object objSavings and objChecking had created it's own DBConnection and had performed the UPDATE statement on it.
So the question is how do you Abort transaction on 2 separate DB connections.
So now (when Enlist = true) each connection (opened on current thread) is enlisted into single 'Global' transaction and if that transaction is aborted all actions perfomed by this connection will rollback.
-----------------------------
I hope i am clear.
So if you set Enlist = false then you will save some runtime. But then you will not be able to do rollback of the 'global' transaction. By default all Global transaction will commit so if you are not doing anything special to roll them back you can safely set it to Enlist = false. You can keep it as true but then you just wasting some runtime.
FYI: The service that manages Global transactions is called 'Microsoft Distributed Transaction Coordinator' you can google it if you want to find more info. It's comes with Windows.
George.
"Marc" <noreply@xxxxxxxxx> wrote in message news:uVhR6rb8IHA.3736@xxxxxxxxxxxxxxxxxxxxxxx
I am reading some book over dotnet. I do not understand this sentence considering connection pooling:
Enlist When this value is true, the connection is automatically enlisted into the
creation threads current transaction context. The default is true.
What is enlisted? It's put on some list? And what is the current transaction context? And why does the creation thread has such a context?
Sorry I do not understand much about this sentence.
.
- Follow-Ups:
- Re: Connection Pooling
- From: Marc
- Re: Connection Pooling
- References:
- Connection Pooling
- From: Marc
- Connection Pooling
- Prev by Date: Re: Building SQL connection string in code-behind file. Works on my machine, not on server.
- Next by Date: Re: Building SQL connection string in code-behind file. Works on my machine, not on server.
- Previous by thread: Connection Pooling
- Next by thread: Re: Connection Pooling
- Index(es):
Relevant Pages
|