Re: Concurrent Connections / Shared Transaction

From: Pablo Castro [MS] (pablocas_at_online.microsoft.com)
Date: 03/16/05


Date: Wed, 16 Mar 2005 14:38:10 -0800

In MARS there are fixed interleave points in the server. For DML statements
(e.g. UPDATEs), the whole statement will run without yielding. For SELECT,
FETCH and a few other statements we'll yield on network writes so if we
return lots of rows you'll see intra-statement interleaving.

There is a great article on MARS here which includes more details on how
statements are interleaved:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90/html/MARSinSQL05.asp

-- 
Pablo Castro
Program Manager - ADO.NET Team
Microsoft Corp.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Shawn B." <leabre@html.com> wrote in message 
news:uL8Xf7bKFHA.1528@TK2MSFTNGP09.phx.gbl...
> What do you mean by interleaved?  Do you mean that one will execute and
> complete and then the other command in the transaction will execute and
> complete and then the next one, from a queue of some sort?  versus 
> executing
> parallel?
>
>
> Thanks,
> Shawn
>
>
> "Pablo Castro [MS]" <pablocas@online.microsoft.com> wrote in message
> news:elFsi4OKFHA.1500@TK2MSFTNGP09.phx.gbl...
>> Actually, bound sessions allow you to share the transaction space among
> two
>> connections but doesn't give you concurrent access to it. If you try to
>> execute a batch on a connection while the other is actively doing
> something
>> within the transaction the server will return an error saying that the
>> transaction context is in use.
>>
>> COM+ is the only solution I know of for this scenario. Even with COM+/DTC
>> you'll see some serialization around the transaction. In ADO.NET 2.0 + 
>> SQL
>> Server 2005 you can mix MARS plus asynchronous command execution to 
>> submit
>> two requests concurrently within the same transaction; however, note that
> in
>> that case you won't get parallelism in the server; multiple MARS sessions
>> within a connection are interleaved, not executed in parallel.
>>
>> -- 
>> Pablo Castro
>> Program Manager - ADO.NET Team
>> Microsoft Corp.
>>
>> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>>
>>
>> "Angel Saenz-Badillos[MS]" <angelsa@online.microsoft.com> wrote in 
>> message
>> news:uJbeJ0FKFHA.1340@TK2MSFTNGP10.phx.gbl...
>> > As long as both connections are to the same instance of Sql Server you
> can
>> > use sp_bindsession to get this behavior without having to use
> distributed
>> > transactions.
>> >
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_ba-bz_9ini.asp
>> >
>> > Hope this helps.
>> > -- 
>> > Angel Saenz-Badillos [MS] Managed Providers
>> > This posting is provided "AS IS", with no warranties, and confers no
>> > rights.Please do not send email directly to this alias.
>> > This alias is for newsgroup purposes only.
>> > I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/
>> >
>> >
>> >
>> >
>> > "Dumitru Sbenghe" <sbenghe@yahoo.com> wrote in message
>> > news:uyT4fXwJFHA.2752@TK2MSFTNGP10.phx.gbl...
>> >> Given the current status of ADO.NET (version 1.1), you can not do what
>> >> you
>> >> want. Because the SqlClient provider permit only one command running 
>> >> on
> a
>> >> given connection at a time, the only solution will be a distributed
>> >> transaction coordinator + 2 connections with 2 commands executed
>> >> concurrently aka ES/COM+ in .NET . or wait until ADO.NET 2.0 will be
>> >> released :), version which will permit this behavior.
>> >>
>> >>
>> >>
>> >> Dumitru
>> >>
>> >>
>> >> "Shawn B." <leabre@html.com> wrote in message
>> >> news:uA6kqFtJFHA.1096@tk2msftngp13.phx.gbl...
>> >> > Greetings,
>> >> >
>> >> > I have two SqlCommands objects that each need to execute 
>> >> > concurrently
>> > but
>> >> > I
>> >> > want them both to be a part of the same transaction.
>> >> >
>> >> > What I'm doing is created one SqlCommand and Beginning a 
>> >> > transaction.
>> >> >
>> >> > I have another SqlCommand that is being executed from within an
>> >> > Asynchronous
>> >> > delegate that needs to participate in the same transaction.  The
>> >> > problem
>> >> > is
>> >> > that I get the infamous exception stating that the connection is
>> >> > already
>> >> > in
>> >> > use.
>> >> >
>> >> > COM+ is not an answer here.
>> >> >
>> >> > What I want to know is if there is a way to make this work correctly
>> > using
>> >> > only ADO.NET?
>> >> >
>> >> >
>> >> > Thanks,
>> >> > Shawn
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
> 


Relevant Pages

  • Re: Concurrent Connections / Shared Transaction
    ... Do you mean that one will execute and ... bound sessions allow you to share the transaction space among ... > connections but doesn't give you concurrent access to it. ... > Server 2005 you can mix MARS plus asynchronous command execution to submit ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Concurrent Connections / Shared Transaction
    ... bound sessions allow you to share the transaction space among ... > Server 2005 you can mix MARS plus asynchronous command execution to submit ... > within a connection are interleaved, ... >>>> I have two SqlCommands objects that each need to execute concurrently ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: error 7390 when isolation level is set to serializable...
    ... How and what do you execute on the server? ... > SET TRANSACTION ISOLATION LEVEL SERIALIZABLE ... > The requested operation could not be performed because the OLE DB provider ...
    (microsoft.public.sqlserver.programming)
  • Re: Help with Master/Detail UI in ADPs
    ... Yes I would plan on dropping DAO use in adps. ... The link about recordsets is quite informative. ... is more native to the way the ADP will access the SQL Server data. ... very tight control of the transaction, ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Help with Master/Detail UI in ADPs
    ... I would look into dropping all DAO code in favor of ADO. ... is more native to the way the ADP will access the SQL Server data. ... very tight control of the transaction, ... bind it to the Detail subform. ...
    (microsoft.public.access.adp.sqlserver)