
MSSQL & ADO & threads ???!!
After some quick testing, ADO Connections are not thread safe (unless you
call getting an exception thread safe). However, parsing Recordsets appears
to be safe (at least with Forward Only cursors). It just seems like you
can't have 2 queries executing queries at the same time. Nexting through 2
Recordsets over the same Connection didn't cause me any problems. In any
case, thread safe code for ADO is the right answer.
If I find where I read ADO was thread safe I'll publish...
Quote:
> I had read that ADO was completely thread safe. Is that not true? I
always
> assumed I could do 2 Execute statements in 2 different threads at the same
> time on the same connection. I just assumed that ADO would "queue" the
SQL
> operations if it couldn't process them in parallel. Hum, if not, then I
had
> better add some thread safe code in...I better go test this out!
> > Adam,
> > I've used ADO connections to SQL in several different threads.
> However, you
> > cannot use a connection by more than one thread at a time. You'll need
> each thread
> > to somehow lock the connection (from some kind of pool), use it till the
> thread is
> > done, then unlock the connection for another thread to use.
> > John
> > > Hi!
> > > I've forgot to write that I try to do it with VC++ 6.0 :-)
> > > > Hi!
> > > > I try to use ADO to work with MSSQL Server but ...
> > > > Is it possible to use one Connection object declared globaly in
many
> > > > threads concurently ?
> > > > I'd like to get 1 connection to SQL server instead of ~100 from
every
> > > > running thread.
> > > > So now I declare 1 Connection object per thread & establish separate
> > > > connection from within (by method Open).
> > > > I've found that such a solution is possible till ~64 threads. Every
> next
> > > > doesn't work though it doesn't return any error ! ??
> > > > ps
> > > > Please, send any answer to my email
Quote:
> > > > --
> > > > Adam Gros
> > > > _________/)____/)_/)__/)____
> > > --
> > > Adam Gros
> > > _________/)____/)_/)__/)____