Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Open Database Connections Problem

Reply
Thread Tools

Open Database Connections Problem

 
 
Lars Netzel
Guest
Posts: n/a
 
      09-08-2004
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





 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      09-08-2004
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:(E-Mail Removed)...
> 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
>
>
>
>
>



 
Reply With Quote
 
 
 
 
Lars Netzel
Guest
Posts: n/a
 
      09-08-2004
How can I register that in debug mode?

/Lars


"Patrice" <(E-Mail Removed)> skrev i meddelandet
news:eaJPj$(E-Mail Removed)...
> 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:(E-Mail Removed)...
> > 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
> >
> >
> >
> >
> >

>
>



 
Reply With Quote
 
Lars Netzel
Guest
Posts: n/a
 
      09-08-2004
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" <(E-Mail Removed)> skrev i meddelandet
news:eaJPj$(E-Mail Removed)...
> 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:(E-Mail Removed)...
> > 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
> >
> >
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
Web app leaving SQL database connections open Robin9876 ASP .Net 2 11-20-2008 05:21 PM
Lingering Idle Oracle Connections? Persistent connections? jobs ASP .Net 2 11-16-2007 03:37 AM
ConnectionState problem - managing connections to an Access database Nick Gilbert ASP .Net 14 07-06-2005 04:16 PM



Advertisments