473,388 Members | 1,092 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,388 software developers and data experts.

Pooling and SqlConnetion?

Hi all
I use 'Pooling=true;' in my connection string;
how can I disable 'pooling' in my application and close all connections???
thanks in advance
Jan 18 '06 #1
4 1732
perspolis,

I wouldn't necessarily do that. What is the purpose here? Just killing
a database connection is a bad thing, since you could be closing it in the
middle of an important operation.

You can always just not place "pooling=true" in the connection string,
and the connections will not be pooled, they will close when your code
closes them.

Of course, you should always use the using statement to make sure your
connections close when you are done using them.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"perspolis" <re*****@hotmail.com> wrote in message
news:ei*************@TK2MSFTNGP15.phx.gbl...
Hi all
I use 'Pooling=true;' in my connection string;
how can I disable 'pooling' in my application and close all connections???
thanks in advance

Jan 18 '06 #2
Pooling=true is the default, it will be on even if this element is not
present in the connection string. change it to:

Pooling=false;

Now as long as you Close each connection, no connections will be returned to
the pool. I think its important to understand that pooled connection objects
are just connection objects, they are not left "Open" - until you open them.

Why do you want to disable connection pooling?

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"perspolis" wrote:
Hi all
I use 'Pooling=true;' in my connection string;
how can I disable 'pooling' in my application and close all connections???
thanks in advance

Jan 18 '06 #3
Nicholas Paldino [.NET/C# MVP] wrote:
I wouldn't necessarily do that. What is the purpose here? Just killing
a database connection is a bad thing, since you could be closing it in the
middle of an important operation.

You can always just not place "pooling=true" in the connection string,
and the connections will not be pooled, they will close when your code
closes them.

Of course, you should always use the using statement to make sure your
connections close when you are done using them.


That doesn't make sure the physical connections will be closed though.

Before now I've had cause to want to remove connections from the pool
having killed them on the SQL Server side (if you're not careful, the
pool doesn't notice that they've died, and you get an exception next
time you try to use them).

Fortunately, in .NET 2.0 you can use SqlConnection.ClearAllPools (or
ClearPool for a specific pool) to do this. Unfortunately I wasn't
working with 2.0 at the time :(

Jon

Jan 18 '06 #4
Jon Skeet [C# MVP] wrote:
Of course, you should always use the using statement to make sure your
connections close when you are done using them.


That doesn't make sure the physical connections will be closed though.


Just to anticipate a reply - yes, it will kill the physical connections
if you have pooling turned off to start with. I hadn't noticed that bit
of Nick's reply :)

Jon

Jan 18 '06 #5

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

Similar topics

5
by: John | last post by:
Does COM.ibm.db2.jdbc.DB2DataSource, (which supports connection pooling) need to be run within a J2EE container environment before the connection pooling facility is actually available to a user? ...
18
by: Rob Nicholson | last post by:
We're getting an occasional occurrence of the following error when two users try and open the same record in our ASP.NET app: "There is already an open DataReader associated with this Connection...
1
by: Lenny Shprekher | last post by:
Hi, I am getting issues that Oracle collecting opened sessions (connections) from my webservice using regular System.Data.OleDb.OleDbConnection object. I am guessing that this is connection...
4
by: Susan Baker | last post by:
PHP Newbie here - I apologize if any of my questions appear daft or obvious ... Does PHP (or maybe the web server - Apache in my case), support (database) connection pooling?. It seems terribly...
2
by: JimLad | last post by:
Hi, In an existing ASP/ASP.NET 1.1 app running on IIS 6, I need to RELIABLY pass the logged in username through to the SQL Server 2000 database for auditing purposes. The current method is...
3
by: howachen | last post by:
Hi, Is that when using pconnect to mysql, it is already mean connection pooling? thanks.
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...
3
by: fniles | last post by:
In the Windows application (using VB.NET 2005) I use connection pooling like the following: In the main form load I open a connection using a connection string that I stored in a global variable...
0
viswarajan
by: viswarajan | last post by:
Introduction This article is to go in deep in dome key features in the ADO.NET 2 which was shipped with VS 2005. In this article I will go trough one of the key features which is the Connection...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.