Results 1 to 7 of 7

Thread: CmdTimeout doesn't work

  1. #1
    Join Date
    May 2008
    Posts
    4

    CmdTimeout doesn't work

    I am working on a legacy application which uses AspDb. The application is written in classic asp and is running on IIS 6.0. I have a query which is timing out when the user tries to download the CSV file for the entire resultset. I have tried setting the CmdTimeout like this:

    MyDb.dbOptions = "CloseConnection=True|CmdTimeOut=360"

    But it continues to timeout. I even tried setting CmdTimeOut to 5 and it still doesn't timeout until 30 seconds. I have tried restarting IIS as well as the entire OS and nothing seems to get this to recognize the change. How do I get this to work. This should have only taken me 5 min to fix and now I've wasted a day on it. Please help me.

  2. #2
    Join Date
    Oct 2002
    Posts
    933
    In asp, there are scripttimeout, commandtimeout and connectiontimeout. What are you trying to do?

    Fk

  3. #3
    Join Date
    May 2008
    Posts
    4
    What I'm saying is that when I set CmdTimeout for AspDb.dbOptions it doesn't work. If it were working, when I set it to 5 seconds I should get a timeout error after 5 seconds. But I don't. No matter what I set the timeout as, the query still times out at 30 seconds.

    I have a query which takes longer than 30 seconds run, I need to extend the timeout to allow the query to complete.

    [edit] please also note that I have tried setting scripttimeout using both the asp declaration and by setting the dbOptions value and this has not made any difference either [edit]
    Last edited by MarkJMiller; 05-14-2008 at 09:11 AM.

  4. #4
    Join Date
    Oct 2002
    Posts
    933
    All timeout are pass through in ASP-db. No magic is perform, just the timeout value is set in the code rather than in the asp file. Depends on how you set them and what is timing out (Connect, command or script). If all failed, then you must be setting them incorrectly. I suggest you use the pureasp.asp test code and set the value w/o asp-db. When you get that going then sent to me to duplicate that in the DLL.

    Fk

  5. #5
    Join Date
    May 2008
    Posts
    4
    What is the pureasp.asp test code? I've never used AspDb before and this is a legacy application that I've never worked on before. I was hired to work on a different application and the only reason I got this task is because I'm the only one who wasn't currently busy.

  6. #6
    Join Date
    May 2008
    Posts
    4
    I didn't have the install for AspDb, after getting it I found pureasp.asp. The code below works, but I had to change AspDb to use a Command object since you can't set CommandTimeout on the recordset object. If pureasp.asp represents the actual implementation of AspDb, then that explains why you can't set the command timeout.

    I also had to turn buffering off since the recordset contains over 40,000 records. The application using AspDb uses the paged results, but the download link at the top of the table doesn't page the results and this is what is causing the timeout.

    Response.Clear()
    Response.Buffer=false
    DataSource = "Driver={sql server};server=myserver; Initial Catalog=mydb; UID=myuid;PWD=mypwd"
    Tablename = "select EventID, StopTime, ReadyTime, StartTime, T, Tons, PU, PrimaryEquipment, CauseEquipmentTag, CauseArea, PlannedUnplanned, Department, System, Component, CauseDetail, SecondCause, LastEditBy, InitialEditBy, Situation from dt_analyst01_v where PU in ('Smelter') and stoptime>='1/1/2007' and stoptime<='5/15/2008'"


    '----------- Modify the two lines above and run this program ----------

    'GridInc = 4

    response.write("<BR><h3>Pure ASP - Navigation Check</h3>")
    response.write("DataSource=" & DataSource & "<BR>")
    response.write("Tablename=" & Tablename & "<BR>")

    myself=request.ServerVariables("SCRIPT_NAME")
    Set oCmd = Server.CreateObject("ADODB.Command")
    Set oConn = Server.CreateObject("ADODB.Connection")
    'Set oRs=Server.CreateObject("ADODB.Recordset")

    response.write("Object created"+"<BR>")
    Cursor=0 'do not change this forward cursor!

    oConn.Open DataSource

    oCmd.CommandText = Tablename
    oCmd.CommandTimeout =360
    oCmd.ActiveConnection = oConn

    Set oRs = oCmd.Execute()

    Count=0

    While not oRs.eof
    Count=Count+1
    oRs.moveNext
    Wend
    oRs.close

    response.write("RecordCount=" & Count & "<BR>")
    response.write("FieldCount=" & oRs.fields.count & "<BR>")

    Set oRs = oCmd.Execute()


    GridInc = Count
    response.write("Start at " & start+1 & "<BR>")
    response.write("<center><table border=1 cellspacing=1 cellpadding=3>")
    response.write("<tr>")
    for i=0 to oRs.fields.count-1
    response.write("<th>" & oRs(i).name & "</th>")
    next
    response.write("</tr><tr>")
    oRs.move start
    for i=start to (start+GridInc-1)
    for j=0 to oRs.fields.count-1
    t=oRs(j).type
    if t=205 then
    t="BLOB"
    else
    if t=201 then
    t="MEMO"
    else
    t=oRs(j)
    end if
    end if
    response.write("<td>" & t & "</td>")
    next
    response.write("</tr>")
    oRs.MoveNext
    if oRs.eof then exit for
    next
    response.write("</table></center>")
    response.write("<A HREF=""" & myself & "?Inc=" & i-GridInc-GridInc & """> Previous </a> ")
    response.write("--")
    response.write("<A HREF=""" & myself & "?Inc=" & i & """> Next </a> ")
    oRs.close
    Set oRs=nothing
    Set oCmd=nothing
    Set oConn=nothing
    set cnn = Server.CreateObject ("ADODB.Connection")
    response.write("<P>ADO Version = " & cnn.Version & "<P>")


    %>
    </CENTER>
    </BODY>
    </HTML>

  7. #7
    Join Date
    Oct 2002
    Posts
    933
    It is possible that classic aspdb has problem is downloading large files. The DotNet version ASP-db.Net has no such problem is sample files download 34K records. If you are a classic ASP-db user and would like to dive into this issue then we need a PO (No Charge - if it is a bug) before we can put manpower into it. For now, you can supply a sample using ASP-db and and an identical sample using pure asp both accessing a common DB like Northwind (there is no way to debug using your own data). There is also a sample DB (hotel2000.mdb) that has 34,273 records that you can use to debug. Download that from the site. If the aspdb sample fails while the other one works then we know there is a 'bug'. Then we can fix it at no charge.

    Fk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •