473,395 Members | 2,151 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,395 software developers and data experts.

connection from asp.net to sqlserver2000 remains open and blocks other connections.

Hi,

i use asp.net and i have a general class that manages database access using
ado.net and sqlclient provider.
this class upon deconstructor closes connection to DB.

it appears on sql 2000 manager when i look in management/current
activity/Process Info that my connections stays open and the number of
connections open is increasing each request.

what am i missing / doing wrong here.
thanks for any input from your experience.

z.
Nov 18 '05 #1
5 1209
best way is to override dispose on that general class.. and you can call it
explicitly or use using() block.
deconstructor gets called when object is removed (i guess when GC is
collecting the object)..

destructors also be called when program exists. is your program existing
here?
Av.

"z. f." <zi**@info-scopeREMSPAM.co.il> wrote in message
news:OK**************@TK2MSFTNGP10.phx.gbl...
Hi,

i use asp.net and i have a general class that manages database access
using
ado.net and sqlclient provider.
this class upon deconstructor closes connection to DB.

it appears on sql 2000 manager when i look in management/current
activity/Process Info that my connections stays open and the number of
connections open is increasing each request.

what am i missing / doing wrong here.
thanks for any input from your experience.

z.

Nov 18 '05 #2
well, since it's an aspx page, the program is aspnet.exe on win2k or
w3wp.exe on win2003 and this process should stay in memory for long time.
so i need to take care of my objects my self.
thanx.


"avnrao" <av*@newsgroups.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
best way is to override dispose on that general class.. and you can call it explicitly or use using() block.
deconstructor gets called when object is removed (i guess when GC is
collecting the object)..

destructors also be called when program exists. is your program existing
here?
Av.

"z. f." <zi**@info-scopeREMSPAM.co.il> wrote in message
news:OK**************@TK2MSFTNGP10.phx.gbl...
Hi,

i use asp.net and i have a general class that manages database access
using
ado.net and sqlclient provider.
this class upon deconstructor closes connection to DB.

it appears on sql 2000 manager when i look in management/current
activity/Process Info that my connections stays open and the number of
connections open is increasing each request.

what am i missing / doing wrong here.
thanks for any input from your experience.

z.


Nov 18 '05 #3
Do you have a message saying the connection pool is full ?

Remember that finalization in .NET is not deterministic and here I suspect
you still have a reference.

I would close explicitely the DB connection as soon as I'm done with it.

Patrice

--

"z. f." <zi**@info-scopeREMSPAM.co.il> a écrit dans le message de
news:OK**************@TK2MSFTNGP10.phx.gbl...
Hi,

i use asp.net and i have a general class that manages database access using ado.net and sqlclient provider.
this class upon deconstructor closes connection to DB.

it appears on sql 2000 manager when i look in management/current
activity/Process Info that my connections stays open and the number of
connections open is increasing each request.

what am i missing / doing wrong here.
thanks for any input from your experience.

z.

Nov 18 '05 #4
ADO.NET manages connection pooling itself, If you do a close or dispose
it does'nt really mean that connection to db server is closed. When you call
connection.close or adapter.close, it actually closes connection to your
applications
object with ado.net, on the other hand ADO.NET is itself maintaining
connections
with database.
Its very important to close both data reader and connection as soon as they
are no longer needed. if you do not do this, they will go out of scope and
the
application will leak a connection and u'll see one more connection.

check this msdn documentation for reference:
http://msdn.microsoft.com/library/en...esigntools.asp

--
Hope this helps,
Zeeshan Mustafa, MCSD
"z. f." <zi**@info-scopeREMSPAM.co.il> wrote in message
news:OK**************@TK2MSFTNGP10.phx.gbl...
Hi,

i use asp.net and i have a general class that manages database access using ado.net and sqlclient provider.
this class upon deconstructor closes connection to DB.

it appears on sql 2000 manager when i look in management/current
activity/Process Info that my connections stays open and the number of
connections open is increasing each request.

what am i missing / doing wrong here.
thanks for any input from your experience.

z.

Nov 18 '05 #5
It is not a good idea to let the finalizer (or deconstructor) close
connections--it simply won't work. As others have said, close the
connections explicitly.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"z. f." <zi**@info-scopeREMSPAM.co.il> wrote in message
news:OK**************@TK2MSFTNGP10.phx.gbl...
Hi,

i use asp.net and i have a general class that manages database access using ado.net and sqlclient provider.
this class upon deconstructor closes connection to DB.

it appears on sql 2000 manager when i look in management/current
activity/Process Info that my connections stays open and the number of
connections open is increasing each request.

what am i missing / doing wrong here.
thanks for any input from your experience.

z.

Nov 18 '05 #6

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

Similar topics

13
by: Larry | last post by:
Hi I have asp.net programs. I used a very simple data transfer method by using URLs ¡°First.aspx¡± contents a line to send data to the ¡°second.aspx¡± page, for
9
by: AccessStarters | last post by:
Can anyone please help me simply connect to northwind? Maybe some logical steps that I may be missing? I have tried many tutorials and they all give similar connections to the one below. Dim...
11
by: Larry | last post by:
Hi I have asp.net programs. I used a very simple data transfer method by using URLs ¡°First.aspx¡± contents a line to send data to the ¡°second.aspx¡± page, for
2
by: Tony Johansson | last post by:
Hello! How does this connection pool function actually ? As I have been told is that when the connection is returned to the pool the connection to the database is still open. What you do is that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.