473,324 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Open Database Connections Problem

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

Nov 18 '05 #1
3 1420
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:OY*************@TK2MSFTNGP12.phx.gbl...
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


Nov 18 '05 #2
How can I register that in debug mode?

/Lars
"Patrice" <no****@nowhere.com> skrev i meddelandet
news:ea**************@TK2MSFTNGP11.phx.gbl...
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:OY*************@TK2MSFTNGP12.phx.gbl...
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



Nov 18 '05 #3
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" <no****@nowhere.com> skrev i meddelandet
news:ea**************@TK2MSFTNGP11.phx.gbl...
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:OY*************@TK2MSFTNGP12.phx.gbl...
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



Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mark | r | last post by:
is there any ASP script that will display a list of all open connections on a shared host im trying to determine if my previous problem with "system resource exceeded" can be resolved by brute...
46
by: Steve | last post by:
Access97 Database The database is split into a frontend and backend and not connected to any other database. The database has an unbound report with 15 subreports. Some of the subreports include...
6
by: ultraton | last post by:
While trying to print a report from Access the user receives the following error: Cannot open any more databases. Okay Help Does anyone have any ideas about this behavior? Thank you very...
1
by: C Sharp beginner | last post by:
I'm sorry about this verbose posting. This is a follow-up to my yesterday's posting. Thanks William for your reply. I understand it is a good practice to open connections as late as possible and...
6
by: Keith Smith | last post by:
I read in a Visual Studio .NET book that with C# it is now recommended to open database connections whenever you need to query a database as opposed to the traditional method of opening a database...
4
by: Nevyn Twyll | last post by:
I've been working on an asp.net application and everything's been great. But suddenly, whether I'm tyring to use a database on my own machine, or on my server, I'm getting a timeout when trying to...
6
by: DraguVaso | last post by:
Hi, I had an error concerning the connection-pool: "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled...
7
by: Brian Kitt | last post by:
I frequently get the above error on my website. It happens only for short periods of times, then the error goes away. I cannot recreate this. I have an error trap that picks up this error. When...
7
by: Tyrone Showers | last post by:
I have a problem of getting the error "too many files open" and would like to trace my application. However, I have found nothing about how to display the current number of open files. Does...
5
by: Usman Jamil | last post by:
Hi I've a class that creates a connection to a database, gets and loop on a dataset given a query and then close the connection. When I use netstat viewer to see if there is any connection open...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.