Re: ADO threadsafe?
From: Andrew (abaylis_nos_at_spamcop.net)
Date: 01/12/04
- Previous message: Tim Jarvis (Borland): "Re: Delphi 8 - ADO?"
- In reply to: Guillem: "ADO threadsafe?"
- Next in thread: Brian Bushay TeamB: "Re: ADO threadsafe?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 12 Jan 2004 11:06:47 +1100
"Guillem" <keinname@eresmas.net> wrote in message
news:40018fc7@newsgroups.borland.com...
> Hi,
>
> just one question. Are ADO componentes thread-safe? I mean, if 2 threads
try
No.
> to access the same ADO component, does this one include some sort of
> critical-section blocking or do I need to use a TCriticalSection component
> to safeguard it?
You would need a TCriticalSection in this circumstance. An alternative
approach is to utilise the internal record / page locking features of ADO
and have a separate connection object in each thread with its own
Recordsets. Thus, each thread is accessing the underlying database in the
same way that multiple users can access the database. I prefer to do things
this way as I don't have to worry about thread synchronization issues at
all. The only issue to watch is that client-side cursors will have their
data in memory and so won't reflect any changes to the database by other
threads/users until refreshed.
HTH
Andrew
- Previous message: Tim Jarvis (Borland): "Re: Delphi 8 - ADO?"
- In reply to: Guillem: "ADO threadsafe?"
- Next in thread: Brian Bushay TeamB: "Re: ADO threadsafe?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]