Results 1 to 7 of 7

Thread: Help with connection timeout?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2005
    Posts
    625

    Help with connection timeout?

    I need help I'm running an SQL query that sometimes works in about 30-45 seconds but usually times out in about 30 seconds.

    Here's my connection string, I set the timeout to 180 (3 minutes), and the server is set to 600, but the web page fails and an exception is thrown 'SQL server timeout', within about 30 seconds.

    Is there another setting thats not allowing it to try for the full 180 seconds?

    "Server=x.x.x.x;Database=mydb;Uid=MyUser;Pwd=MyPass;Connect Timeout=180;" />

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Help with connection timeout?

    There issue may be due to your other code etc, as several database connection technologies have their own time-outs in addition to those provided by the database system.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2005
    Posts
    625

    Re: Help with connection timeout?

    I'm using .NET 2.0, SQLConnection function.

    When I do SqlCn.ConnectionTimeout it displays correctly (180).

    Where else might there be a bottleneck that is shortening my timeout?

  4. #4
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: Help with connection timeout?

    Two possibilities:

    1. If the data returned from this connection is part of the basic html of your webpage, i.e. the page isn't finished loading until it has this data, then it could very well be that the browser is timing out because if a page hasn't finished loading within a certain amount of time, most browsers will assume that something must be wrong. If this is the case, then you need to load your page first and then run this connection and update a frame on the page perhaps. You could put a little loading gif.

    2. Your ISP is forcibly cutting the connection because it's been open too long.

  5. #5
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Help with connection timeout?

    Are you sure it isn't your command object timing out?

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2005
    Posts
    625

    Re: Help with connection timeout?

    Thanks, it was the command object that was timing out (before the actual connection ). Setting the command object itself to the same timeout as the connection object fixed the problem.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2005
    Posts
    625

    Re: Help with connection timeout?

    This is resolved

    (sorry my edit's not working)

Posting Permissions

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



Click Here to Expand Forum to Full Width