PC Review


Reply
Thread Tools Rate Thread

clearing connection pool

 
 
Srinivas Kollipara
Guest
Posts: n/a
 
      4th Jan 2005
Hi,
in my C# project it uses 24 sql connections, i am clearing all the
conncetions whenever an error occurs and when i see in the performance
monitor for that pool i can still see all those 24 connections sitting over
there. so i am wondering how to clear the connection pool in C#. can anyone
suggest me in this. i need to do that programmatically. thanks in advance.
srinivas


 
Reply With Quote
 
 
 
 
Amit
Guest
Posts: n/a
 
      4th Jan 2005
ADO.NET uses connection pooling so even if you're closing your connections
in the code, the framework will keep them open for a while (until the
connection lifetime ends). As far as I know, currently there's no way to
force closing of actual connections to the database (other than disabling
connection pooling totally which is not recommended). I believe next version
of ADO.NET will provide the ability to clear the connection pools.
-Amit

"Srinivas Kollipara" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
> in my C# project it uses 24 sql connections, i am clearing all the
> conncetions whenever an error occurs and when i see in the performance
> monitor for that pool i can still see all those 24 connections sitting

over
> there. so i am wondering how to clear the connection pool in C#. can

anyone
> suggest me in this. i need to do that programmatically. thanks in advance.
> srinivas
>
>



 
Reply With Quote
 
Sahil Malik
Guest
Posts: n/a
 
      4th Jan 2005
Srinivas,

In .NET 1.1 you cannot clear the connection pool. And that is not such a big
deal because eventually they will close out or be reused per application
demands. The problem is when the SQL Server reboots and all your connections
that your side thinks are open and will throw weird errors now.

In .NET 2.0 however, the connection pool is cleared for you at the first
instance of such an error, so you do get this error once, but only once.
Alternatively, the SqlConnection object provides you with methods to clear
all connection pools or clear connection pool per connectionstring should
you choose to do so manually.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik




"Srinivas Kollipara" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
> in my C# project it uses 24 sql connections, i am clearing all the
> conncetions whenever an error occurs and when i see in the performance
> monitor for that pool i can still see all those 24 connections sitting
> over
> there. so i am wondering how to clear the connection pool in C#. can
> anyone
> suggest me in this. i need to do that programmatically. thanks in advance.
> srinivas
>
>



 
Reply With Quote
 
Srinivas Kollipara
Guest
Posts: n/a
 
      4th Jan 2005
thanks for your help
srinivas
"Amit" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> ADO.NET uses connection pooling so even if you're closing your connections
> in the code, the framework will keep them open for a while (until the
> connection lifetime ends). As far as I know, currently there's no way to
> force closing of actual connections to the database (other than disabling
> connection pooling totally which is not recommended). I believe next

version
> of ADO.NET will provide the ability to clear the connection pools.
> -Amit
>
> "Srinivas Kollipara" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> > in my C# project it uses 24 sql connections, i am clearing all the
> > conncetions whenever an error occurs and when i see in the performance
> > monitor for that pool i can still see all those 24 connections sitting

> over
> > there. so i am wondering how to clear the connection pool in C#. can

> anyone
> > suggest me in this. i need to do that programmatically. thanks in

advance.
> > srinivas
> >
> >

>
>



 
Reply With Quote
 
Srinivas Kollipara
Guest
Posts: n/a
 
      4th Jan 2005
thanks for your help
srinivas

"Sahil Malik" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Srinivas,
>
> In .NET 1.1 you cannot clear the connection pool. And that is not such a

big
> deal because eventually they will close out or be reused per application
> demands. The problem is when the SQL Server reboots and all your

connections
> that your side thinks are open and will throw weird errors now.
>
> In .NET 2.0 however, the connection pool is cleared for you at the first
> instance of such an error, so you do get this error once, but only once.
> Alternatively, the SqlConnection object provides you with methods to clear
> all connection pools or clear connection pool per connectionstring should
> you choose to do so manually.
>
> - Sahil Malik
> http://dotnetjunkies.com/weblog/sahilmalik
>
>
>
>
> "Srinivas Kollipara" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> > in my C# project it uses 24 sql connections, i am clearing all the
> > conncetions whenever an error occurs and when i see in the performance
> > monitor for that pool i can still see all those 24 connections sitting
> > over
> > there. so i am wondering how to clear the connection pool in C#. can
> > anyone
> > suggest me in this. i need to do that programmatically. thanks in

advance.
> > srinivas
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
How to set the connection pool size in the Sybase connection string? Wei Lu Microsoft ASP .NET 2 16th Feb 2009 09:51 AM
Leftover Connections in Connection Pool (connection leak) hiriumi@gmail.com Microsoft ADO .NET 2 25th Jan 2007 04:09 AM
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. Guoqi Zheng Microsoft ASP .NET 4 3rd Jun 2004 07:39 PM
Clearing SQL-Server connection pool Ramon de Klein Microsoft ADO .NET 1 18th Dec 2003 07:31 PM
Clearing the Connection Pool Brian Adams Microsoft ADO .NET 2 29th Oct 2003 09:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:03 PM.