Re: Ado, Threads (and videotape)

From: Guillem (guillemvicens_at_clubgreenoasis.com)
Date: 03/16/05


Date: Wed, 16 Mar 2005 13:13:52 +0100

Hi,

"Josu Z." <josu@leako.com> escribió en el mensaje
news:4238146e$1@newsgroups.borland.com...
> Ado, Threads (and videotape)
> I have an object whose properties can be written and read form different
> threads.
>
> I protect the attributes with a TMultiReadExclusiveWriteSynchronizer.
>
> The thing is that i want some of these attributes be persistent in a
> Access BD (using ADO). I would like the object to write in the BD, within
> the SetValue functions of his properties.
>
> But doing this, I write in the BD within the context of the threads, and
> any of the thread should have his own ADOConnection. Shouldn't it?

No. You can have only one TADOConnection for it. Having multiple
TADOConnections has sense, for example, if you need to connect to multiple
databases and don't want to change the ConnectionString, but not for
threads.

IMO it's better to use a TCriticalSection or equivalent to assure that only
one thread is accessing to the TADOConnection. Also, on threads don't forget
to use CoInitialize before you use any ADO component and Couninitialize
after using it.

-- 
Best regards :)
Guillem Vicens
Dep. informática Green Service SA
guillemvicens@clubgreenoasis.com
www.clubgreenoasis.com 


Relevant Pages

  • simultaneous read/write using ado
    ... I'm writing a delphi program that writes a dbf file using ado. ... I'm using TADOConnection and TADOCommand. ... I want to execute two programs that read and write simultaneously in the same dbf file. ... Do I need to build some security to avoid a corrupt database or is this taken care of in the ADO component? ...
    (microsoft.public.data.ado)
  • Re: Calling the ConnectionString Creator dialog
    ... >TADOConnection, clicking in the ConnectionString property you can bring up a ... I'm sure this is just the ADO dialog from micorsoft, ...
    (borland.public.delphi.database.ado)
  • Re: trivial (or not?) question about MSAccess login
    ... Create a new datamodule. ... Drop a TADOConnection on it from the ... ADO page of the component palette. ...
    (alt.comp.lang.borland-delphi)
  • ADO Threads and Connection Pooling
    ... What does the statement "ADO is thread safe" actually mean? ... I want to create a multi-threaded data processing application. ... do I need a separate TADOConnection created in each thread. ...
    (borland.public.delphi.database.ado)
  • Re: VB 6 and MS SQL Server 2000 - (Yudkin)
    ... Since you have multiple SELECT statement, ... If I need to use ADO, what components do I have to include in my project? ... GetClipString is an RDO API. ... SQL SP's have no concept of event flows. ...
    (microsoft.public.vb.general.discussion)