Article View: borland.public.cppbuilder.database.ado
Article #1023Re: Access 2000 DB Question
From: Viatcheslav V. Vassiliev
Date: Mon, 13 Dec 2004 07:41
Date: Mon, 13 Dec 2004 07:41
78 lines
3591 bytes
3591 bytes
For Access use TADOTable with TableDirect = true, server-side client cursor.
Client-side cursor (UpdateBatch too) composes and executes SQL queries to
make inserts. Call DisableControls()/EnableControls() even if there is no
controls attached. Executing inserts inside transaction will speed up 2-3
times.
For fastest speed look at OLEDB Direct (http://www.oledbdirect.com), example
in "Examples\Tutorial\Step 6 - transaction". You will be able to avoid ADO
layer and use OLEDB interfaces directly.
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"J Borchers" <jborchers@noemailtome.com> �������/�������� � ��������
���������: news:41bc7ed6$1@newsgroups.borland.com...
> Hi all,
>
> I have an access 2000 DB. I get horrid performance doing INSERT
statements.
> I use the ADOQuery component. I have a table created as such:
>
> Query1->SQL->Add("CREATE TABLE Articles");
> Query1->SQL->Add("(ArticlesID COUNTER,");
> Query1->SQL->Add("ServerID LONG, GroupsID LONG,");
> Query1->SQL->Add("Subject CHAR (100) NOT NULL,");
> Query1->SQL->Add("ArticleNumber LONG,");
> Query1->SQL->Add("Checksum LONG,");
> Query1->SQL->Add("PRIMARY KEY (ArticlesID))");
> TrySQL();
>
> At first I would add records using the SQL Insert statement adding one
> record at a time. This took about 50mS per record - way too slow for a
> 1.8GHz machine with 650 MB ram.
>
> Then, I changed the source to do this:
>
> ArticlesQuery->Insert();
> ArticlesQuery->FieldValues["ServerID"]=
> ServersQuery->FieldValues["ServerID"];
> ArticlesQuery->FieldValues["GroupsID"]=
> GroupListQuery->FieldValues["GroupsID"];
> ArticlesQuery->FieldValues["Subject"]=Subject;
> ArticlesQuery->FieldValues["ArticleNumber"]=ArticleNumber;
> int chk=Recovery1->Checksum(Subject);
> ArticlesQuery->FieldValues["Checksum"]=chk;
> ArticlesQuery->Post();
>
> Then every 5000 records I do:
>
> ArticlesQuery->UpdateBatch(arAll);
>
> where ArticlesQuery is:
>
> LockType=batchOptimistic;
>
> It seems to take the same amount of time total to do either?
>
> What is the best way (or proper way) to add a list of records at one time?
> What is the best local database to use for this. I would expect
performance
> that is somewhere close to adding structures to a file not the horrid
> performance I am getting.
>
> Any help appreciated TIA,
>
> John Borchers
>
>
>
>
>
>
>
Technical Details
Message-ID:
<41bd47a3$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<41bc7ed6$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,52c9d377ef0d87a7 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <41bc7ed6$1@newsgroups.borland.com> Subject: Re: Access 2000 DB Question Date: Mon, 13 Dec 2004 10:41:24 +0300 Lines: 80 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 62.205.171.210 Message-ID: <41bd47a3$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1102923683 62.205.171.210 (12 Dec 2004 23:41:23 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail