We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

increase timeout ms sql 2005 queries from asp

robrodp
robrodp asked
on
Medium Priority
715 Views
Last Modified: 2012-05-06
I have this code in an asp script.

It times out too often. How can I icrease the timeout time?

From the ms sql manager it does not tine out, Can it be a connection string issue?

Set MyRecordSet = Server.CreateObject("ADODB.RecordSet")
cn = application("connection")
sql="select count(*) as cuantos from people"
MyRecordSet.Open sql, cn
cuantos=MyRecordSet("cuantos")
MyRecordSet.Close
MyRecordsSet=Nothing

Open in new window

Comment
Watch Question

try
cn.timeout = 900 (this is 900 seconds=15 minutes)
robrodpProgrammer

Author

Commented:
cn is the connection string defined in global.asa as:

application("connection")="Provider=SQLNCLI;Server=74.86.187.166\SQL2k5,1435;Database=database;Uid=user;Pwd=password;"

So the  cn.timeout = 900
(this is 900 seconds=15 minutes)
does not work
my bad
i was sure cn is a connection object
you can try what is describe here
http://sethbuckley.com/ado-recordset-timeout-on-ms-sql-server/
but it seems weird
anyway,
if you create a connection object (which is probably created implicitly so your won't hurt performance)
 you can set its timeout property

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Raja Jegan RSQL Server DBA & Architect, EE Solution Guide
CERTIFIED EXPERT
Awarded 2009
Distinguished Expert 2019

Commented:
Thinking the other way around, why is your query taking much time..
If you tune it out and bring it out to less time, then no timeouts issues, right..
robrodpProgrammer

Author

Commented:
Good it works
Now how can I increase the timeout for:

c.Open cn
sql="update table set name='john' where id=123
c.Execute sql
c.Close
set c = nothing
robrodpProgrammer

Author

Commented:
I have tuned it with indexes
Raja Jegan RSQL Server DBA & Architect, EE Solution Guide
CERTIFIED EXPERT
Awarded 2009
Distinguished Expert 2019

Commented:
After creating your indexes and if you tune out your query, then I am sure you wont face any Timeout issues.

create indexes on the columns in Where clause and joins to improve performance
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.