Article View: microsoft.public.data.ado
Article #1Problem with ADO, thread apartments, and Connections
From: CRBD
Date: Wed, 03 Oct 2001 21:38
Date: Wed, 03 Oct 2001 21:38
29 lines
2498 bytes
2498 bytes
Greetings, In our application, we start two independent threads whose function is to open a connection to two different databases in two different machines. Each thread starts its own thread apartment, instantiates a Connection object, and issues an Open() in the Connection. Our application requires at least one of the connections to be opened successfully. If the both databases are on-line, the Open() method returns quickly, but if one of the databases is off line, the Open() method can take almost a minute to return. The idea behind the two threads was to speed-up the initialization of the application when one of the databases was down or off line. Just take the first one that connects. For example, if one database is on-line and the other is down, the application would take seconds to start, instead of waiting more than a minute, which would be the case if we had to try to open both databases sequentially. Unfortunately, our experiments have shown that ADO seems to be serializing the Open() requests, even though the threads, Connection objects, and apartments are completelly independent. In other words, the second Open() is executed only when the first one completed. This is quite puzzling! Your comments and suggestions are greatly appreciated. cd
Technical Details
Message-ID:
<aa89243e.0110031338.7c1c9eb@posting.google.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10845c,f2f33eb99da918c7,start X-Google-Attributes: gid10845c,public X-Google-Thread: 109d21,f2f33eb99da918c7,start X-Google-Attributes: gid109d21,public X-Google-Thread: f5cad,f2f33eb99da918c7,start X-Google-Attributes: gidf5cad,public X-Google-Thread: 10c622,f2f33eb99da918c7,start X-Google-Attributes: gid10c622,public X-Google-ArrivalTime: 2001-10-03 14:38:52 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail From: crbd@cs.purdue.edu (CRBD) Newsgroups: microsoft.public.data.ado,microsoft.public.vb.database.ado,microsoft.public.access.modulesdaovba.ado,borland.public.delphi.database.ado Subject: Problem with ADO, thread apartments, and Connections Date: 3 Oct 2001 14:38:52 -0700 Organization: http://groups.google.com/ Lines: 29 Message-ID: <aa89243e.0110031338.7c1c9eb@posting.google.com> NNTP-Posting-Host: 206.163.220.157 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1002145132 9867 127.0.0.1 (3 Oct 2001 21:38:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 3 Oct 2001 21:38:52 GMT