Open Database Connections Problem

Discussion in 'ASP .Net' started by Lars Netzel, Sep 8, 2004.

  1. Lars Netzel

    Lars Netzel Guest

    Hey!

    I have problems with timeout cause of problems obtaining a pool in the SQL
    server.. and I guess It's because I might have forgotten to Close some
    sqlConnection somewhere.. so I search thru my project and found 172 places
    where I open a connection and I steped thru all the code in those place to
    see if there was a Close command for each Connectionobject. In someplaces I
    had to add a close command and then I recomplied and updated the Solution.

    I still get the same problem.. from a spefiic situation where a few special
    pages are involved. that makes me think it is a problem in the code and not
    with the server or poolsize or anything. I have looked thru the code again
    and there is for sure a Close command for each Open.

    In Try statements I have put the Close command in the Finally statement
    (that's the way to do it right?)

    please help, what else have I missed?

    /Lars Netzel
     
    Lars Netzel, Sep 8, 2004
    #1
    1. Advertising

  2. Lars Netzel

    Patrice Guest

    Yes, the usual caveats is to forgot to close a connection when an exception
    is raised. That said it looks like unlikely you have so much exceptions that
    the problem appears immediatly.

    In debug mode you could also register these connections to warn of unclaeand
    connection at the end of the request.

    As a side note I would stronly suggest to have a data access layer so that
    you have only few open/close paris in your code...

    Patrice


    --

    "Lars Netzel" <[stop_spam]@host.topdomain> a écrit dans le message de
    news:...
    > Hey!
    >
    > I have problems with timeout cause of problems obtaining a pool in the SQL
    > server.. and I guess It's because I might have forgotten to Close some
    > sqlConnection somewhere.. so I search thru my project and found 172 places
    > where I open a connection and I steped thru all the code in those place to
    > see if there was a Close command for each Connectionobject. In someplaces

    I
    > had to add a close command and then I recomplied and updated the Solution.
    >
    > I still get the same problem.. from a spefiic situation where a few

    special
    > pages are involved. that makes me think it is a problem in the code and

    not
    > with the server or poolsize or anything. I have looked thru the code again
    > and there is for sure a Close command for each Open.
    >
    > In Try statements I have put the Close command in the Finally statement
    > (that's the way to do it right?)
    >
    > please help, what else have I missed?
    >
    > /Lars Netzel
    >
    >
    >
    >
    >
     
    Patrice, Sep 8, 2004
    #2
    1. Advertising

  3. Lars Netzel

    Lars Netzel Guest

    How can I register that in debug mode?

    /Lars


    "Patrice" <> skrev i meddelandet
    news:eaJPj$...
    > Yes, the usual caveats is to forgot to close a connection when an

    exception
    > is raised. That said it looks like unlikely you have so much exceptions

    that
    > the problem appears immediatly.
    >
    > In debug mode you could also register these connections to warn of

    unclaeand
    > connection at the end of the request.
    >
    > As a side note I would stronly suggest to have a data access layer so that
    > you have only few open/close paris in your code...
    >
    > Patrice
    >
    >
    > --
    >
    > "Lars Netzel" <[stop_spam]@host.topdomain> a écrit dans le message de
    > news:...
    > > Hey!
    > >
    > > I have problems with timeout cause of problems obtaining a pool in the

    SQL
    > > server.. and I guess It's because I might have forgotten to Close some
    > > sqlConnection somewhere.. so I search thru my project and found 172

    places
    > > where I open a connection and I steped thru all the code in those place

    to
    > > see if there was a Close command for each Connectionobject. In

    someplaces
    > I
    > > had to add a close command and then I recomplied and updated the

    Solution.
    > >
    > > I still get the same problem.. from a spefiic situation where a few

    > special
    > > pages are involved. that makes me think it is a problem in the code and

    > not
    > > with the server or poolsize or anything. I have looked thru the code

    again
    > > and there is for sure a Close command for each Open.
    > >
    > > In Try statements I have put the Close command in the Finally statement
    > > (that's the way to do it right?)
    > >
    > > please help, what else have I missed?
    > >
    > > /Lars Netzel
    > >
    > >
    > >
    > >
    > >

    >
    >
     
    Lars Netzel, Sep 8, 2004
    #3
  4. Lars Netzel

    Lars Netzel Guest

    Found the problem...

    I found a Function that had a Return line (which then off course ends the
    function) on the line before the Close command.. stupid!

    /Lars

    "Patrice" <> skrev i meddelandet
    news:eaJPj$...
    > Yes, the usual caveats is to forgot to close a connection when an

    exception
    > is raised. That said it looks like unlikely you have so much exceptions

    that
    > the problem appears immediatly.
    >
    > In debug mode you could also register these connections to warn of

    unclaeand
    > connection at the end of the request.
    >
    > As a side note I would stronly suggest to have a data access layer so that
    > you have only few open/close paris in your code...
    >
    > Patrice
    >
    >
    > --
    >
    > "Lars Netzel" <[stop_spam]@host.topdomain> a écrit dans le message de
    > news:...
    > > Hey!
    > >
    > > I have problems with timeout cause of problems obtaining a pool in the

    SQL
    > > server.. and I guess It's because I might have forgotten to Close some
    > > sqlConnection somewhere.. so I search thru my project and found 172

    places
    > > where I open a connection and I steped thru all the code in those place

    to
    > > see if there was a Close command for each Connectionobject. In

    someplaces
    > I
    > > had to add a close command and then I recomplied and updated the

    Solution.
    > >
    > > I still get the same problem.. from a spefiic situation where a few

    > special
    > > pages are involved. that makes me think it is a problem in the code and

    > not
    > > with the server or poolsize or anything. I have looked thru the code

    again
    > > and there is for sure a Close command for each Open.
    > >
    > > In Try statements I have put the Close command in the Finally statement
    > > (that's the way to do it right?)
    > >
    > > please help, what else have I missed?
    > >
    > > /Lars Netzel
    > >
    > >
    > >
    > >
    > >

    >
    >
     
    Lars Netzel, Sep 8, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Do
    Replies:
    2
    Views:
    378
    srinivas moorthy
    Dec 9, 2003
  2. Guest
    Replies:
    4
    Views:
    317
    Guest
    May 26, 2004
  3. Nick Gilbert
    Replies:
    14
    Views:
    2,784
    William \(Bill\) Vaughn
    Jul 6, 2005
  4. jobs
    Replies:
    2
    Views:
    917
  5. Robin9876
    Replies:
    2
    Views:
    374
    George
    Nov 20, 2008
Loading...

Share This Page