πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #4947

Re: Access DB in a thread

#4947
From: Harold Howe (TeamB)
Date: Tue, 04 Sep 2001 16:10
21 lines
1636 bytes

> My problem is how to acess a DB in a thread without synchronize (is needed
for the method open).
> A solution is access DB with ADO directly (without a VCL component), but I
donοΏ½t know how.

ADO is not guaranteed to be thread safe. Actually, I have read that ADO
itself is thread safe, but the underlying OLEDB providers are not. In short,
you can't have execute two queries through the same ado connection at the
same time.

The solution to this is to create one ado connection per thread. Each thread
uses it's own connection. You can get more extravegant and create a pool of
ado connections. But when you get down to it, each thread needs a connection
of its own.

PS: the ado connection string gives you an easy way to clone a connection.

Harold Howe [TeamB]
http://www.bcbdev.com
Technical Details
Message-ID: <3b94fcd9$1_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3b932125$1_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,491ffc07c7ae4b86
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2001-09-04 09:14:37 PST
From: "Harold Howe \(TeamB\)" <hhowe@bcbdev.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3b932125$1_2@dnews>
Subject: Re: Access DB in a thread
Date: Tue, 4 Sep 2001 11:10:34 -0500
Lines: 23
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 12.152.193.134
Message-ID: <3b94fcd9$1_1@dnews>
X-Trace: dnews 999619801 12.152.193.134 (4 Sep 2001 09:10:01 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!dnews