Sporadic db connection error - only occurrs on live environment

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Sporadic db connection error - only occurrs on live environment

    I get the following error message very sporadically: "The connection
    cannot be used to perform this operation. It is either closed or
    invalid in this context."

    This error does not occur in the development environment, only the
    live environment.

    It will happen once or twice every hundred times when I update the
    same info. And when it does occur, all I have to do is refresh the
    page and the error disappears and the information gets updated, as it
    should.

    I've trapped the error and was able to identify that it happens at
    line 5 (set cmd.ActiveConnection = conn) of the following function.

    Function GetSubs(intParentId)
    On error Resume Next
    dim cmd
    set cmd = Server.CreateObject("ADODB.Command")
    set cmd.ActiveConnection = conn
    cmd.CommandText = "SP_GET_CHILD_SUBS"
    cmd.CommandType = adCmdStoredProc
    cmd.Parameters.Append cmd.CreateParameter("PARENT_ID", adInteger,
    adParamInput, , intParentId)
    Set GetSubsections = cmd.execute
    If err.number <> 0 Then
    Call ReportError("GetSubsections", err.number, err.description)
    End If
    set cmd = nothing
    On Error Goto 0
    End Function

    I've tested the db connection state (conn.State) when the error is
    raised and the connection is open.

    Does anyone have a clue as to what's going on?
    Shaun OGrady Guest

  2. Similar Questions and Discussions

    1. Sporadic loss of FORM scope data
      Up to 10% of my users get errors when submitting forms. FORM scope is totally gone (no FIELDNAMES, no hidden fields, zip, nada) I have done the...
    2. Live Broadcast Error
      I am trying to utilize the Libe Broadcast demo that was on here with FCS 1.5. Every time I try to connect the broadcaster to the server I get this...
    3. Sporadic font replacement
      Greetings, I have been experiencing a problem with FreehandMX in Panther. There are text boxes that have helvetica text in them and when I open...
    4. Window 2003 Environment issue - Component Access error
      Hi all, An application which is working perfectly in Windows 2000 Server is now installed in Window 2003 Server. A component (VB Component)...
    5. sporadic "page cannot be displayed" error
      Sporadically, our clients receive "page cannot be displayed" error. Failure does not occur at the same line, but error code and description are...
  3. #2

    Default Re: Sporadic db connection error - only occurrs on live environment

    I'm not sure that you should use "set" on that statement.
    set cmd.ActiveConnection = conn

    when you "set" the other properties, of cmd, you don't use "set":
    cmd.CommandText = "SP_GET_CHILD_SUBS"

    try not using "set"

    or wait, and see what ray at home has to say.


    "Shaun OGrady" <shaun@greenbutton.ca> wrote in message
    news:2d805e52.0307230931.4bde94d4@posting.google.c om...
    > I get the following error message very sporadically: "The connection
    > cannot be used to perform this operation. It is either closed or
    > invalid in this context."
    >
    > This error does not occur in the development environment, only the
    > live environment.
    >
    > It will happen once or twice every hundred times when I update the
    > same info. And when it does occur, all I have to do is refresh the
    > page and the error disappears and the information gets updated, as it
    > should.
    >
    > I've trapped the error and was able to identify that it happens at
    > line 5 (set cmd.ActiveConnection = conn) of the following function.
    >
    > Function GetSubs(intParentId)
    > On error Resume Next
    > dim cmd
    > set cmd = Server.CreateObject("ADODB.Command")
    > set cmd.ActiveConnection = conn
    > cmd.CommandText = "SP_GET_CHILD_SUBS"
    > cmd.CommandType = adCmdStoredProc
    > cmd.Parameters.Append cmd.CreateParameter("PARENT_ID", adInteger,
    > adParamInput, , intParentId)
    > Set GetSubsections = cmd.execute
    > If err.number <> 0 Then
    > Call ReportError("GetSubsections", err.number, err.description)
    > End If
    > set cmd = nothing
    > On Error Goto 0
    > End Function
    >
    > I've tested the db connection state (conn.State) when the error is
    > raised and the connection is open.
    >
    > Does anyone have a clue as to what's going on?

    Tammy B. Guest

  4. #3

    Default Re: Sporadic db connection error - only occurrs on live environment

    Bob and Tammy, thank you for your replies.

    I've tested the data connection state at the time that the error is
    raised and the connection state is open.

    I believe that the problem lies in a discrepancy in the IIS and/or SQL
    Server settings between the production and development environment
    because (as aforementioned) the error only occurrs on the production
    environment.

    Shaun O

    "Bob Barrows" <reb_01501@yahoo.com> wrote in message news:<#T0tJKdUDHA.2076@TK2MSFTNGP11.phx.gbl>...
    > There is no problem using Set here, since you are setting a property that
    > contains an object to another object. In this case the "set" is not
    > necessary, but it is not hurting either. It definitely hasn't hurt any of
    > the applications in which I've used it.
    >
    > The problem is the conn variable. He should check its State property before
    > using it here. He may have closed it somewhere else in his code. I'm not
    > even sure where it was instantiated or opened ... it must have been because
    > he says it is a sporadic error.
    >
    > Bob Barrows
    >
    >
    > Tammy B. wrote:
    > > I'm not sure that you should use "set" on that statement.
    > > set cmd.ActiveConnection = conn
    > >
    > > when you "set" the other properties, of cmd, you don't use "set":
    > > cmd.CommandText = "SP_GET_CHILD_SUBS"
    > >
    > > try not using "set"
    > >
    > > or wait, and see what ray at home has to say.
    > >
    > >
    > > "Shaun OGrady" <shaun@greenbutton.ca> wrote in message
    > > news:2d805e52.0307230931.4bde94d4@posting.google.c om...
    > >> I get the following error message very sporadically: "The connection
    > >> cannot be used to perform this operation. It is either closed or
    > >> invalid in this context."
    > >>
    > >> This error does not occur in the development environment, only the
    > >> live environment.
    > >>
    > >> It will happen once or twice every hundred times when I update the
    > >> same info. And when it does occur, all I have to do is refresh the
    > >> page and the error disappears and the information gets updated, as it
    > >> should.
    > >>
    > >> I've trapped the error and was able to identify that it happens at
    > >> line 5 (set cmd.ActiveConnection = conn) of the following function.
    > >>
    > >> Function GetSubs(intParentId)
    > >> On error Resume Next
    > >> dim cmd
    > >> set cmd = Server.CreateObject("ADODB.Command")
    > >> set cmd.ActiveConnection = conn
    > >> cmd.CommandText = "SP_GET_CHILD_SUBS"
    > >> cmd.CommandType = adCmdStoredProc
    > >> cmd.Parameters.Append cmd.CreateParameter("PARENT_ID", adInteger,
    > >> adParamInput, , intParentId)
    > >> Set GetSubsections = cmd.execute
    > >> If err.number <> 0 Then
    > >> Call ReportError("GetSubsections", err.number, err.description)
    > >> End If
    > >> set cmd = nothing
    > >> On Error Goto 0
    > >> End Function
    > >>
    > >> I've tested the db connection state (conn.State) when the error is
    > >> raised and the connection is open.
    > >>
    > >> Does anyone have a clue as to what's going on?
    Shaun OGrady Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139