Desperate for help on serious TCP/IP connectivity problem



I have posted a detailed discussion of the problem on
microsoft.public.ado. However I am cross-posting this now because we
are very keen to determine if anyone else has had this problem.
Actually desperate might be a more accurate term.

Basically we have discovered that connecting to SQL Server 2000 (or
MSDE either SP2 or SP3a) via TCP/IP under ADO results in queries being
pre-emptable by Windows events under certain circumstances.

This has resulted in random failures in a large VB6 application because
a routine in VB containing an ADO query can be randomly interrupted by
an event, such as a focus change - you can imagine the consequences of
this, because VB code is normally written on the assumption that unless
you yield (i.e call Doevents), then your routine will execute to
completion before any event will be processed.

We have established that ADO queries under both the ODBC (MSDASQL) and
OLEDB drivers are subject to this problem, and that the problem occurs
with various ADO commands e.g opening a recordset or performing an
execute command, for example. We tested under MDAC 2.6 but we believe
the problem also occurs with later releases, and probably lies
somewhere deep in the TCP/IP stack.

The problems do not appear under named pipes, as far as we can
determine. In fact, we are desperately hoping they won't, because there
is no workaround for this issue other than switching to named pipes
that we can think of (after all, if your queries can randomly get
interrupted, you'll need gate flags everywhere - a nightmare!)

The problem will occur if

(a) the target database is on the client machine
(b) the connection to the database is made via TCP/IP
(c) the database needs to perform disk I/O to satisfy the query (using
DBCC DROPCLEANBUFFERS will often provoke the problem, therefore).

We suspect the problem is specific to XP (currently testing on SP1) but
cannot at this stage confirm that it does not occur on Win2K.

The problem has been reproduced on multiple machines and databases, so
we know it is not a specific hardware glitch.

We have observed that a variety of windows messages can interrupt
queries under these circumstances, WM_TIMER and WM_FOCUS messages in
particular.

We suspect that deep in the TCP/IP stack something is pumping messages,
in effect causing the query to 'yield'.

The problem is reproducible both in compiled code and in the VB6
development environment, but we believe VB is only showing the problem,
not responsible for it.

To clarify

...... some code

oConnection.execute sSql
>>>>> this may yield, causing an event to be processed when you don't want it to
...... more code, which you normally would expect to complete
end sub

note that almost any query-invoking command is prone to this problem so
this code will also fail

dim rs as new adodb.recordset
set rs.activeconnection = oConn
rs.open sSql
>>>> can be pre-empted at this point, before the open actually returns to VB
..... more code
end sub

.



Relevant Pages

  • Re: Run action query in back-end from front-end database
    ... ADO is a more generic approach. ... Since DAO was designed specifically for use with Jet databases, ... And I still don't buy your argument about why you have the queries in the ... whatnot in the back end database. ...
    (microsoft.public.access.externaldata)
  • Re: Help! Difficulty understanding DB -> Object mapping
    ... In your transactional database, the schema must be ... The product title (and price) can be retrieved by a very ... direct (using ADO) or indirect. ... >> This seems like too many queries... ...
    (comp.object)
  • Re: DAO to ADO and stored procs
    ... We are moving an entire project from DAO to ADO. ... The Database is MS Access 2000 and nothing is changed from the database ... The problems are mainly queries with params, ... Access SQL syntax is a little different when you move from DAO to ADO ...
    (borland.public.delphi.database.ado)
  • Re: VBA CODE - ADODB
    ... You do not want to use DAO with Access or anything else at this time. ... A second reason is there's no advantage that ADO is going to give you ... It all depends on the code and queries. ... > most VB/DB code is so God-awful that the database layer doesn't matter. ...
    (microsoft.public.vb.general.discussion)
  • Re: access 2003
    ... I would focus on the queries behind the combo boxes. ... the Access 97 database, I wouldn't have thought any expressions would be ... When you select a customer and a job in the two combo boxes, ...
    (microsoft.public.access.conversion)