ADO seemingly terminating batch

From: Dennis Forbes (dennis.forbes_at_gmail.com)
Date: 09/28/04


Date: 28 Sep 2004 07:52:46 -0700

Good day to you.

We are currently experiencing a serious problem with a production
system relating to SQL Server and ADO - This is a batch processing
system running against SQL Server using ADO/OLEDB MDAC 2.8 to
communicate.

In essence the batch processing system is a COM+ component that is
provided with a set of ids, upon which it sequentially calls a worker
procedure in the SQL Server 7.00.961 hosted database for each id using
ADO/OLEDB, and that procedure then performs all of the processing
steps for that id. Each per id procedure in SQL Server begins with a
begin tran if the @@trancount is 0, and ends with a commit or a
rollback if it opened one itself (otherwise presuming that the caller
is managing the transaction), acting as atomic operations. Within each
procedure if an error is discovered RAISERROR is called with a
severity of 16 using custom errors and programmatic flow continues,
usually returning out to the per id procedure where the transaction is
rolled back and execution continues on the next id.

The issue we have encountered, and this was only observed within the
past few months (thus may relate to recent patches), is that some
batches are terminating in midstream, occasionally being rolled back
atomically, while other times it is leaving a transaction open on the
connection. For instance in one process we have identified a divide by
zero warning message as being the point at which the batch apparently
terminates - Note that the settings are such that a divide by zero
does not abort the batch, and furthermore the paragraph following
proves that this should not be the expected behaviour.

To make matters more complex this batch termination only occurs if
adExecuteNoRecords is passed as an option to the Execute method of the
command object. If this option is not set the batch continues as
expected. Furthermore even with adExecuteNoRecords if either a PRINT
or RAISERROR with a severity of 10 is executed before the point at
which the batch abort is occurring, the batch continues to completion.

Does anyone have any ideas of what could be causing this behaviour? Is
this a bug in TDS/ADO/OLEDB when a certain sequence of events occur
and it aborts the batch from the client end? Anyone have any tips on
how to better diagnose this? Unfortunately we are experiencing this in
highly complex procedures including many levels of calls, triggers,
DBCCs or bcps, etc, and thus far I have been unable to artificially
duplicate this in test cases, so there is some factor that has yet
been unidentified.



Relevant Pages

  • ADO seemingly terminating batch
    ... We are currently experiencing a serious problem with a production ... system relating to SQL Server and ADO - This is a batch processing ... In essence the batch processing system is a COM+ component that is ...
    (microsoft.public.sqlserver.programming)
  • Re: How can I force a pause in program execution?
    ... The problem is that the table creation isn't complete before ... > insert command fires. ... It is a batch delimiter recognized by SQL ... SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: Inserting Multiple Rows
    ... In addition to that [BCP, BULK INSERT, DTS], it might be worth mentioning below two things. ... Group several INSERT in the same transaction. ... Each batch requires a network roundtrip, ... mean what we see as "GO" in Query Analyzer and the method you use in ADO.NET to send the command to SQL Server ...
    (microsoft.public.sqlserver.server)
  • Re: testing @@error in SP
    ... Some errors in SQL Server cause the abortion of the T-SQL batch they are. ... the batch and can be handled with an error handler. ...
    (microsoft.public.sqlserver.programming)
  • Re: Inserting Multiple Rows
    ... In addition to that [BCP, BULK INSERT, DTS], it might be worth mentioning below two things. ... Group several INSERT in the same transaction. ... Each batch requires a network roundtrip, ... mean what we see as "GO" in Query Analyzer and the method you use in ADO.NET to send the command to SQL Server ...
    (microsoft.public.sqlserver.programming)