473,320 Members | 1,987 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,320 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 1731
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:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.