Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADOconnection Timeout Error

Status
Not open for further replies.

Tony1l

Programmer
Dec 21, 2002
30
0
0
US
I use Delphi 2007 and i'm sending a query that takes approximately 45-55 seconds for a result. I tested this with Query Analyzer. My ADO connection times out at 30 seconds which is the default setting no matter what I set the connection time out to be.

Code Snipit:
AdoConnection1.ConnectionTimeout:=300;
AdoConnection1.CommandTimeout:=300;
Adoquery1.close;
Adoquery1.sql.add('select * from db.table');
adoquery1.open;

My sql example is simplified the actual SQL contains 4 unions for 4 differing databases which dramatically slow the queries. This should work if the ADOconnection would give it more time. I'm open to suggestions.

 
I fixed it.. I had to add

ADOquery1.CommandTimout:=300;

:)
 
try :

Code:
Adoquery1.close;
Adoquery1.sql.add('select * from db.table');
Adoquery1CommandTimeout:=300;
Adoquery1.open;

on a side note, do you really need all the data you are pulling from this query? maybe limiting the number of rows (SQL TOP command) is an option, or apply a filter (WHERE clause)?

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
oops too late :)

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
you can also send non dataset queries via ADOConnection, this is where the ADOConnection/CommandTimeout parameter will have effect.

one tip: tek-tips has a good SQL server forum, show them your query, maybe it can be optimized...

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top