Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > connection from asp.net to sqlserver2000 remains open and blocks other connections.

Reply
Thread Tools

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

 
 
avnrao
Guest
Posts: n/a
 
      06-21-2004
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." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      06-21-2004
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." <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
 
z. f.
Guest
Posts: n/a
 
      06-21-2004
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.


 
Reply With Quote
 
z. f.
Guest
Posts: n/a
 
      06-21-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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." <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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.
> >
> >

>
>



 
Reply With Quote
 
M. Zeeshan Mustafa
Guest
Posts: n/a
 
      06-21-2004
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." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      06-21-2004
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." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Methods and blocks - not that clear when blocks passed into Steven Taylor Ruby 9 04-27-2009 08:46 AM
linux remains a major scalable open source security vulnerability woo Computer Support 28 12-30-2005 01:57 PM
procs/blocks - blocks with procs, blocks with blocks? matt Ruby 1 08-06-2004 01:33 AM
Dbase remains open after closing FP98 Terry Ledwith ASP General 0 08-22-2003 10:32 AM



Advertisments