Problem with ADO, thread apartments, and Connections


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.