Article View: borland.public.cppbuilder.database.ado
Article #5474Re: ADO Command and Connection Timeout parameters
From: Peter Dam
Date: Fri, 20 Apr 2001 14:20
Date: Fri, 20 Apr 2001 14:20
85 lines
3677 bytes
3677 bytes
Thomas, Thanks for the trick, it does work. I posted the original thread for two weeks without a response, I thought I should fix the bug myself. I went through the ADO source code and found that the ADOQuery & ADOStoredProcedure have their own Timeout parameters which do relate to the Timeout parameter of the ADOConnection at all - same as what you said. I have then created a derived class of ADOQuery and ADOStoredProcedure, with these derived classes I can now control the timeout parameter. If you need the source for the derived, let me know. Peter Thomas Wagener <wagener@rs-system.de> wrote in message news:3add6123_2@dnews... > > "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:
<3ae04499_2@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.tele.dk!130.133.1.3!fu-berlin.de!news.bnb-lp.com!dnewsReferences:
<3ac8a67e_1@dnews> <3add6123_2@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-20 07:42:04 PST Reply-To: "Peter Dam" <pdam@tesco.net> From: "Peter Dam" <pdam@tesco.net> Newsgroups: borland.public.cppbuilder.database.ado References: <3ac8a67e_1@dnews> <3add6123_2@dnews> Subject: Re: ADO Command and Connection Timeout parameters Date: Fri, 20 Apr 2001 15:20:15 +0100 Lines: 87 Organization: IYHF X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: 194.222.46.173 Message-ID: <3ae04499_2@dnews> X-Trace: dnews 987776153 194.222.46.173 (20 Apr 2001 07:15:53 -0700) Path: arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.tele.dk!130.133.1.3!fu-berlin.de!news.bnb-lp.com!dnews