Connection Pooling

Discussion in 'ASP .Net' started by Marc, Jul 29, 2008.

  1. Marc

    Marc Guest

    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.
    Marc, Jul 29, 2008
    #1
    1. Advertising

  2. Marc

    George Guest

    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" <> wrote in message
    news:...
    >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.
    >
    George, Jul 30, 2008
    #2
    1. Advertising

  3. Marc

    Marc Guest

    "George" <> wrote

    > I hope i am clear.


    Perfectly clear, thanks a lot!
    :)
    Marc, Jul 30, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Trevor Hartman

    connection pooling

    Trevor Hartman, Jul 28, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    544
    Mark Heimonen
    Jul 28, 2003
  2. Chris Szabo

    connection pooling error

    Chris Szabo, Aug 19, 2003, in forum: ASP .Net
    Replies:
    6
    Views:
    1,859
    Chris Szabo
    Aug 19, 2003
  3. William \(Bill\) Vaughn

    Re: SqlConnection and connection pooling

    William \(Bill\) Vaughn, Nov 14, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    485
    William \(Bill\) Vaughn
    Nov 14, 2003
  4. =?Utf-8?B?UGllcnNvbiBD?=

    Connection Pooling, Dispose/Close/Using

    =?Utf-8?B?UGllcnNvbiBD?=, Oct 14, 2004, in forum: ASP .Net
    Replies:
    9
    Views:
    4,580
    speedy
    Nov 26, 2008
  5. =?Utf-8?B?VmFtJHk=?=

    Connection pooling

    =?Utf-8?B?VmFtJHk=?=, Nov 24, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    477
    Patrice
    Nov 24, 2004
Loading...

Share This Page