Article View: borland.public.cppbuilder.database.ado
Article #5470Re: ADO Command and Connection Timeout parameters
From: Thomas Wagener
Date: Wed, 18 Apr 2001 09:40
Date: Wed, 18 Apr 2001 09:40
57 lines
2915 bytes
2915 bytes
"Peter Dam" <pdam@tesco.net> schrieb im Newsbeitrag news:3ac8a67e_1@dnews...
> Hi I am not sure if anyone has this problem before.
>
> I updated the ADO component recently, and have found that the new ADO
> component ignores the values set in Command and Connection Timeout
> parameters, and always generates a timeout error message after 30 seconds.
>
> This means that I cannot run any query which takes longer than 30 seconds.
>
> I wonder is there any solution to this problem? I am using BCB5 Enterprise
> version, and the latest ADO component downloaded from Borland web site.
>
> Thanks in advance
>
> Peter
Hi Peter,
I had the same problem but yesterday I found a solution that works for me on
the Borland community site. The solution was well hidden in some chat
transcript.
My problem was that the ConnectionTimeout property of TADOConnection had no
effect when I use the TADOConnection instance with a TADOQuery object. The
ConnectionTimeout property of TADOQuery is read-only. For this reason you
are stuck with TADOQuery.
The workaround is to use a TADODataSet.
So, instead of
dbConnectionPtr= new TADOConnection(0);
dbConnectionPtr->ConnectionString = connectionString;
dbConnectionPtr->ConnectionTimeout = 120; // Set timeout to 120 s.
dbConnectionPtr->Open(userName,passWord);
...
TADOQuery* dbFileQuery = new TADOQuery(0);
dbFileQuery->Connection = dbConnectionPtr;
dbFileQuery->SQL->Text = queryString;
dbFileQuery->Open();
...
// ConnectionTimeout has NO effect
you should use
TADODataSet* dbDocumentQuery = new TADODataSet(0);
dbDocumentQuery->Connection = dbConnectionPtr;
dbDocumentQuery->CommandTimeout=300;
dbDocumentQuery->CommandType = cmdText;
dbDocumentQuery->CommandText = queryString;
dbDocumentQuery->Open();
// Timeout is set to 300s.
Hope this helps,
Thomas
Technical Details
Message-ID:
<3add6123_2@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3ac8a67e_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,18c7e7d864e9356 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-04-18 02:48:07 PST From: "Thomas Wagener" <wagener@rs-system.de> Newsgroups: borland.public.cppbuilder.database.ado References: <3ac8a67e_1@dnews> Subject: Re: ADO Command and Connection Timeout parameters Date: Wed, 18 Apr 2001 11:40:51 +0200 Lines: 59 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 217.0.58.206 Message-ID: <3add6123_2@dnews> X-Trace: dnews 987586851 217.0.58.206 (18 Apr 2001 02:40:51 -0700) Path: arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews