Re: Why use Connection.Close in ADO?
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Wed, 20 Dec 2006 12:14:14 -0500
jeff wrote:
I have an application that runs on a COM+ server and talks with aSetting the connection to nohing is supposed to cause the connection to
Sybase Database. The application does not containe any
connection.close methods.
It uses set connection = nothing in place of close and then a set to
nothing. Now this is an application I am taking over from another
programmer and I am wondering what problems this may cause?
Most of the set connection = nothing is in the terminate methods of
the class.
close. However, if child objects are open, or if a transaction is
active, the connection may refuse to close, causing an orphaned object,
i.e., a memory leak.
There are two possible consequences of failing to use the Close method:
1. Connections may be left open longer than they need to be, causing new
connections to be spawned by other threads/processes instead of existing
connections being used from the session pool, resulting in too many
connections open to the server at once. This can cause sporadic
connection failures. In a server environment, it is critical that
connections be closed as soon as the code is finished with them to
maximize session pool effectiveness.
2. Setting the connection to nothing (dereferencing it) is supposed to
cause the connection to close. However, if child objects are open, or if
a transaction is active, the connection may refuse to close, causing an
orphaned object, i.e., a memory leak.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
.
- Prev by Date: Re: Allow Zero Length in ADO with VB6
- Next by Date: Re: Finding Out DSN Selected by User
- Previous by thread: Allow Zero Length in ADO with VB6
- Next by thread: Re: Finding Out DSN Selected by User
- Index(es):
Relevant Pages
|
|