• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 704
  • Last Modified:

increase timeout ms sql 2005 queries from asp

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

0
robrodp
Asked:
robrodp
  • 3
  • 2
  • 2
1 Solution
 
momi_sabagCommented:
try
cn.timeout = 900 (this is 900 seconds=15 minutes)
0
 
robrodpAuthor 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
0
 
momi_sabagCommented:
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
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
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..
0
 
robrodpAuthor 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
0
 
robrodpAuthor Commented:
I have tuned it with indexes
0
 
Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now