473,729 Members | 1,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ADO connections do they clean up by themselves?

Hi,

Can anyone tell me, if you were to open a connection to a database at the
top of each ASP page in a website, for example like this

<%
dim dbconn

set dbconn=server.c reateobject("AD ODB.connection" )
dbconn.Connecti onString= "File name=c:\databas econnection.udl "
on error resume next
dbconn.open
if err.number <0 then
log_errs "Can Not Connect to database",""
Response.Redire ct whome & "/closed.asp"
end if
on error goto 0

%>

use the connection, but never close the connection at the end of the page,
what will happen? Ie, how long will the database connection stay open? Is
the connection to the DB automatically closed when you leave the page, or
does it leave the connection open but idle, and therefore up to the
individual DB to eventually timeout and reuse the connection? Does it
potentially cause a memory leak, because you end up with lots of unused
connection and recordset objects that are no longer in use? Would it cause
sleeping sessions in a SQL Server database?

I realise it is preferable always to close connections and recordsets and
set them = to nothing when you have finished with them. But I really need to
know what the implications are if this doesn't happen.

Thanks in advance.
Janette
Jul 25 '06 #1
6 3299
Hello,

When you create an ADO connection in an ASP application, the ADO connetion
object will be created in IIS' process. If you don't close it and set it to
nothing, it will leave idle in the process for a while (depends on IIS).
For ADO record set, there are server side recordset and client side
recordset. Client side recordset will also leave in the IIS process as ADO
connection. So, it is risk to leave many connections or recordsets in the
an ASP application without close them.

Sincerely,

Luke Zhang

Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 25 '06 #2
Hello,

How is it going on now? Is the information I provided in the previous
message helpful? If you need further assistance on the issue, please feel
free to let us know.

Sincerely,

Luke Zhang

Microsoft Online Community Support
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 27 '06 #3
Hi Luke,

There is another thread which is providing good information. I did some
research and found that Oracle connections don't remain open very long, even
if you don't close them. But I am yet to test SQL Server. But, I still don't
know if it does cause memory leaks and how to detect it if it is. Let alone
what the symptoms of a memory leak from an IIS perspective would be.

Regards
Janette
"Luke Zhang [MSFT]" <lu******@onlin e.microsoft.com wrote in message
news:Pv******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hello,

How is it going on now? Is the information I provided in the previous
message helpful? If you need further assistance on the issue, please feel
free to let us know.

Sincerely,

Luke Zhang

Microsoft Online Community Support
This posting is provided "AS IS" with no warranties, and confers no
rights.

Jul 27 '06 #4
Hello Janette,

To detect a Memory Leak, we can use the counters in System Performance
Monitor, here is an article about this:

http://support.microsoft.com/?kbid=325558

SQL server also provides some System Performance counter, which can help us
determine the connection number and status of a Server SQL database.

Sincerely,

Luke Zhang

Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 28 '06 #5
Hi Luke,

This webcase about detecting memory leaks is good. The only thing is, if I
think an ASP application might be causing a memory leak, how do I know which
process this would be on the server. I gather that IIS runs several dllhost
process which are the IIS processes. Is there a specific ASP process?

Regards
Janette

"Luke Zhang [MSFT]" <lu******@onlin e.microsoft.com wrote in message
news:Eq******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hello Janette,

To detect a Memory Leak, we can use the counters in System Performance
Monitor, here is an article about this:

http://support.microsoft.com/?kbid=325558

SQL server also provides some System Performance counter, which can help
us
determine the connection number and status of a Server SQL database.

Sincerely,

Luke Zhang

Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Jul 28 '06 #6
Hello Janette,

To watch a specific ASP application's memory usage, you may:

1. Configure the new virtual folder to run in High Isolation - Out of
Process , so that the ASP application runs under a separate copy of
Dllhost.exe.
2. From your browser, run asp application.
3. To view memory usage, start Windows Task Manager and click the
Processes tab. One instance of Dllhost.exe shows linear growth in memory
usage, corresponding to the memory leak.

Sincerely,

Luke Zhang

Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 31 '06 #7

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

Similar topics

4
2590
by: dustin lee | last post by:
Over the years I've gotten out of the habit of explicitly closing file objects (whether for reading or writing) since the right thing always seems to happen auto-magically (e.g. files get written to disk with no missing data). I've recently started do the same thing with database connections. I'm wondering if anyone has had trouble with this sort of "lazy" programming style. My assumption is the the database connection will get closed...
6
1554
by: Chris McAvoy | last post by:
Hi, Every morning around 11am, we run out of database connections. We have one user, and a bunch of scripts that use that account to connect to the database. I believe we have a bad script out there that's routinely chewing up our available connections. I plan on turning on as much logging as possible tonight. Are there any other tools out there that can help me figure out exactly which script is generating the connections?
5
3024
by: news | last post by:
Well, I wrote my first PHP class today. Yeah! But to get it to work, in each function within the class I have to repeat the database connection lines, and that just seems redundant; there has to be a better way that I'm just not bright enough to think of. Any suggestions? (It's the first 3 lines of each of the two functions below. When I have it fully written, there will be about 10 similar functions, each repeating those three lines.)
8
1820
by: ra294 | last post by:
I have an ASP.net application using SQL Server 2000 that every once in a while I am getting this error: "System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached" I looked at my code and It seems that I do close every connection that I open so I don't know why I am getting...
7
1410
by: darrel | last post by:
We're running into a problem on our new site. Once a week or so, our site goes down with an 'out of memory error'. Rebooting the web server fixes things. Googling the error doesn't return many results (one, actually) and the suggested fix is to make sure you are manually closing all DB connections. I'm doing that now, but I had thought that asp.net had fairly robust automated cleanup, and that having to explicitely close every connection...
182
7538
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
37
3981
by: Joshua Ruppert | last post by:
When I'm using FastCGI do I need to code differently than I do when using regular CGI? Because the PHP.exe processes don't go away do global variables stick around from page request to page request, creating the need for better managment / pooling of DB connections? Josh
6
4360
by: Steve Ricketts | last post by:
I have a webservice written in VB.net that opens a connection to SQL Server 2000 with a connection string. The connection remains open for the life of the web service so the ADODB.connection is defined as public and used by a single subroutine, SQLexecute. All recordset definitions are defined in the individual subroutines and destroyed before exit of the subroutine. I would expect only one connection to be made to the SQL Server but...
9
24577
by: Greg | last post by:
I'm creating a tcp socket connection from the thread in the c# threadpool. Since the default workers thread is 500, sometimes my program tries to open up 500 different tcp socket connections and the connection fails after it reaches certain number of opened tcp connection. I guess it reached the max number of tcp connection available in the operating system. I have Professional Windows XP 2000. So what is the max simultaneous tcp...
0
8768
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9436
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9298
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9226
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8170
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3248
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2705
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2173
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.