Is ADO thread safe? 
Author Message
 Is ADO thread safe?

I'd like to use ADO in a multithreaded C++ app. Can I make a single
connection object and have different threads add records to the same table
using that connection? Would this work with MS SQL Server as well as with
the Jet engine? Would using OLE DB be different as far as these issues go?
Thanks.

-Alex



Tue, 07 Jan 2003 03:00:00 GMT  
 Is ADO thread safe?
Alex,
  I'm not sure whether ADO connections themselves are thread safe, but I do know that
using them with SQL Server 7.0 or the Jet engine makes them unsafe.  To properly
handle it with SQL 7.0, I made a pool of connections which are locked when a thread
is using it.  When the thread is done with the connection, it is released and
available for use by another thread.  This should provide the thread safety that you
need.  (i.e. Don't *use* the same connection in more than one thread at the same
time.)

John


Quote:
> I'd like to use ADO in a multithreaded C++ app. Can I make a single
> connection object and have different threads add records to the same table
> using that connection? Would this work with MS SQL Server as well as with
> the Jet engine? Would using OLE DB be different as far as these issues go?
> Thanks.

> -Alex



Tue, 07 Jan 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Is ADO really thread-safe?

2. ANN: sigslot - C++ Portable, Thread-Safe, Type-Safe Signal/Slot Library

3. Using a non-thread-safe library with threads?

4. Thread functions are thread-safe?

5. how do i create thread safe worker thread

6. Safe array and ado

7. Insert Using ADO/VC++: What am I missing?

8. Is NetworkStream.Write() thread safe?

9. Why OleDbCommand objects are not thread safe?

10. Thread-safe DataTable.Rows.Add

11. Thread Safe Events and Static Methods

12. Are C# properties thread safe?

 

 
Powered by phpBB® Forum Software