469,275 Members | 1,463 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

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.createobject("ADODB.connection")
dbconn.ConnectionString= "File name=c:\databaseconnection.udl"
on error resume next
dbconn.open
if err.number <0 then
log_errs "Can Not Connect to database",""
Response.Redirect 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 3168
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******@online.microsoft.comwrote in message
news:Pv**************@TK2MSFTNGXA01.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******@online.microsoft.comwrote in message
news:Eq**************@TK2MSFTNGXA01.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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by dustin lee | last post: by
6 posts views Thread by Chris McAvoy | last post: by
8 posts views Thread by ra294 | last post: by
7 posts views Thread by darrel | last post: by
182 posts views Thread by Jim Hubbard | last post: by
37 posts views Thread by Joshua Ruppert | last post: by
6 posts views Thread by Steve Ricketts | last post: by
9 posts views Thread by Greg | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.