🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
3 messages
3 total messages Started by Peter Dam Mon, 02 Apr 2001 16:23
ADO Command and Connection Timeout parameters
#5597
Author: Peter Dam
Date: Mon, 02 Apr 2001 16:23
14 lines
1381 bytes
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
Re: ADO Command and Connection Timeout parameters
#5470
Author: Thomas Wagener
Date: Wed, 18 Apr 2001 09:40
57 lines
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
Re: ADO Command and Connection Timeout parameters
#5474
Author: Peter Dam
Date: Fri, 20 Apr 2001 14:20
85 lines
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
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads