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

clearing connection pool

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
Nov 16 '05 #1
4 5738
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" <sk********@stratasolutions.com> wrote in message
news:uY**************@TK2MSFTNGP14.phx.gbl...
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

Nov 16 '05 #2
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" <sk********@stratasolutions.com> wrote in message
news:uY**************@TK2MSFTNGP14.phx.gbl...
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

Nov 16 '05 #3
thanks for your help
srinivas
"Amit" <re***********@hotmail.com> wrote in message
news:#k**************@TK2MSFTNGP14.phx.gbl...
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" <sk********@stratasolutions.com> wrote in message
news:uY**************@TK2MSFTNGP14.phx.gbl...
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


Nov 16 '05 #4
thanks for your help
srinivas

"Sahil Malik" <co*****************@nospam.com> wrote in message
news:uc**************@tk2msftngp13.phx.gbl...
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" <sk********@stratasolutions.com> wrote in message
news:uY**************@TK2MSFTNGP14.phx.gbl...
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


Nov 16 '05 #5

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

Similar topics

4
by: Mahesh D. Rane | last post by:
Hi, I am connecting to sql databse from windows C# form. when i close the form, then also the connection to databse is active. Its not allowing me to delete the database. But if i close the...
11
by: pradeep_TP | last post by:
Hi all, I have a few questions that I have been wanting to ask for long. These are all related to ADO.net and specifically to conenction to database. 1) If I have opened a connection to a...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
3
by: LRK | last post by:
I am in the process of moving an ASP.NET app from my development machine to a web server. I am getting the following error message: Message: "Timeout expired. The timeout period elapsed prior to...
10
by: Steven Blair | last post by:
As I understand it, if I create a connection object in my application and close the connection, the next time I open a connection with the same connection string I should be using a pooled...
2
by: RyoSaeba | last post by:
Hello, I have a problem with the session state set to Sql Server (AspNet 1.1, Windows Server 2003 on an Application Center cluster, Sql Server 2000 on another server). Sometimes, when many user...
2
by: JoeSep | last post by:
Hi! Is it correct/safe to define a connection pool in the string "sqlConnectionString" of the "sessionState" section of Web.config? - The application is developed using AspNet 1.1 in a Windows...
16
by: crbd98 | last post by:
Hello All, Some time ago, I implemented a data access layer that included a simple connectin pool. At the time, I did it all by myself: I created N connections, each connection associated with...
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.