473,654 Members | 3,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disconnecting form the SQL server

I have an application that connects to an SQL server. I need to be able to
disconnect all connection that I opened. I am closing and disposing the
connection but the connection pool is keeping them alive for later use. How
do I convince the connection pool to drop the connections without closing my
program.

Regards,
John
Nov 23 '05 #1
6 2555
John,

If you are going to use the connection pool, then the pool will decide
when to close the connections it is holding. After all, if your program is
still running, you might need them again, right?

If you want, you can turn off connection pooling by altering the
connection string, placing:

Pooling=False

In the string.

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

"John J. Hughes II" <no@invalid.com > wrote in message
news:Op******** ******@TK2MSFTN GP11.phx.gbl...
I have an application that connects to an SQL server. I need to be able to
disconnect all connection that I opened. I am closing and disposing the
connection but the connection pool is keeping them alive for later use.
How do I convince the connection pool to drop the connections without
closing my program.

Regards,
John

Nov 23 '05 #2
John,
The connections that have been returned to the Connection Pool aren't "open".
When you re-use a connection string, ADO.NET checks the pool to see if it
has a matching one and returns the connection object. You still have to open
this connection to use it, so it wasn't "tying up" SQL Server by sitting in
the pool.
Hope that helps clarify.
Peter

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


"John J. Hughes II" wrote:
I have an application that connects to an SQL server. I need to be able to
disconnect all connection that I opened. I am closing and disposing the
connection but the connection pool is keeping them alive for later use. How
do I convince the connection pool to drop the connections without closing my
program.

Regards,
John

Nov 23 '05 #3
When my program first starts and for a long while there after I want
connection pooling so it is enable. At some point I need to do maintance to
the DB so I need all connection to the DB dropped or I get and error. So at
that point will not need them later and want them to go away. I will then
need them back again so I would like them to start working.

Basially I need to be able to disconnect the connection pool connection
without closing my program.

Regards,
John

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:ew******** ******@tk2msftn gp13.phx.gbl...
John,

If you are going to use the connection pool, then the pool will decide
when to close the connections it is holding. After all, if your program
is still running, you might need them again, right?

If you want, you can turn off connection pooling by altering the
connection string, placing:

Pooling=False

In the string.

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

"John J. Hughes II" <no@invalid.com > wrote in message
news:Op******** ******@TK2MSFTN GP11.phx.gbl...
I have an application that connects to an SQL server. I need to be able
to disconnect all connection that I opened. I am closing and disposing
the connection but the connection pool is keeping them alive for later
use. How do I convince the connection pool to drop the connections without
closing my program.

Regards,
John


Nov 23 '05 #4
Oh, maybe I am misunderstandin g something then. If I open enterprise
manager and view the process info it says my application has 4 sleeping
connections which are causing me errors. The only way to remove the 4
connections is to close my application. My best guess was the connection
were being held by the connection pool, I know they are being closed from my
application. Do you know where they are coming from and how to close them?

Regards,
John

"Peter Bromberg [C# MVP]" <pb*******@yaho o.nospammin.com > wrote in message
news:6C******** *************** ***********@mic rosoft.com...
John,
The connections that have been returned to the Connection Pool aren't
"open".
When you re-use a connection string, ADO.NET checks the pool to see if it
has a matching one and returns the connection object. You still have to
open
this connection to use it, so it wasn't "tying up" SQL Server by sitting
in
the pool.
Hope that helps clarify.
Peter

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


"John J. Hughes II" wrote:
I have an application that connects to an SQL server. I need to be able
to
disconnect all connection that I opened. I am closing and disposing the
connection but the connection pool is keeping them alive for later use.
How
do I convince the connection pool to drop the connections without closing
my
program.

Regards,
John

Nov 23 '05 #5
John,

From the connection pool, these will only be removed from the pool (and the
connection with the DB server closed) after a certain time-out period
(provider specific).
You can make sure the DB connection is closed whenever you close or Dispose
your Connection object (say SqlConnection) by specifying a "Connection
Lifetime" value other than zero .
Note that when doing this you will loose the advantage of connection
pooling.

Willy.

"John J. Hughes II" <no@invalid.com > wrote in message
news:e$******** ******@tk2msftn gp13.phx.gbl...
Oh, maybe I am misunderstandin g something then. If I open enterprise
manager and view the process info it says my application has 4 sleeping
connections which are causing me errors. The only way to remove the 4
connections is to close my application. My best guess was the connection
were being held by the connection pool, I know they are being closed from
my application. Do you know where they are coming from and how to close
them?

Regards,
John

"Peter Bromberg [C# MVP]" <pb*******@yaho o.nospammin.com > wrote in message
news:6C******** *************** ***********@mic rosoft.com...
John,
The connections that have been returned to the Connection Pool aren't
"open".
When you re-use a connection string, ADO.NET checks the pool to see if it
has a matching one and returns the connection object. You still have to
open
this connection to use it, so it wasn't "tying up" SQL Server by sitting
in
the pool.
Hope that helps clarify.
Peter

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


"John J. Hughes II" wrote:
I have an application that connects to an SQL server. I need to be able
to
disconnect all connection that I opened. I am closing and disposing the
connection but the connection pool is keeping them alive for later use.
How
do I convince the connection pool to drop the connections without
closing my
program.

Regards,
John


Nov 23 '05 #6
Thanks for the response. Basically that is what I concluded but was seeing
if there was something I missed, guess not.

Thanks,
John

"Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message
news:eR******** ******@TK2MSFTN GP10.phx.gbl...
John,

From the connection pool, these will only be removed from the pool (and
the connection with the DB server closed) after a certain time-out period
(provider specific).
You can make sure the DB connection is closed whenever you close or
Dispose your Connection object (say SqlConnection) by specifying a
"Connection Lifetime" value other than zero .
Note that when doing this you will loose the advantage of connection
pooling.

Willy.

"John J. Hughes II" <no@invalid.com > wrote in message
news:e$******** ******@tk2msftn gp13.phx.gbl...
Oh, maybe I am misunderstandin g something then. If I open enterprise
manager and view the process info it says my application has 4 sleeping
connections which are causing me errors. The only way to remove the 4
connections is to close my application. My best guess was the connection
were being held by the connection pool, I know they are being closed from
my application. Do you know where they are coming from and how to close
them?

Regards,
John

"Peter Bromberg [C# MVP]" <pb*******@yaho o.nospammin.com > wrote in
message news:6C******** *************** ***********@mic rosoft.com...
John,
The connections that have been returned to the Connection Pool aren't
"open".
When you re-use a connection string, ADO.NET checks the pool to see if
it
has a matching one and returns the connection object. You still have to
open
this connection to use it, so it wasn't "tying up" SQL Server by sitting
in
the pool.
Hope that helps clarify.
Peter

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


"John J. Hughes II" wrote:

I have an application that connects to an SQL server. I need to be
able to
disconnect all connection that I opened. I am closing and disposing
the
connection but the connection pool is keeping them alive for later use.
How
do I convince the connection pool to drop the connections without
closing my
program.

Regards,
John



Nov 25 '05 #7

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

Similar topics

18
2849
by: chris | last post by:
I'd like to initiate a php script using a standard httpd request, but then allow the client browser to disconnect without terminating the script. Freeing up the browser to access other functions on the site. Whilst a combination of connection_timeout() and ignore_user_abort() can stop the script from terminating when the client calls termination, i'd like to terminate the clients connection rather than having to wait for the client to...
0
1287
by: phoenix | last post by:
Hi, i'm using a dsl connection to surf the internet. I use the following code to connect to the internet : // Check if already connected if (InternetAttemptConnect(0) != 0) return false; handle = InternetOpen("", INTERNET_OPEN_TYPE_PRECONFIG, "", "", 0); if (handle != 0) {
2
3461
by: cmd | last post by:
I use a utility database and the following code to link from an original backend to a temporary backend, in order to replace the original with a newer version: Dim dbs As Database Dim tdf As TableDef Dim Tdfs As TableDefs Dim Pathname As String Set dbs = CurrentDb Set Tdfs = dbs.TableDefs
7
8190
by: Andreas Håkansson | last post by:
Hello, I'm building a small TCP based server which uses the Async commands. When a new connection is made to the server, I store the new socket in a hashtable, using the client IP as the key. Then I have a method in my server which is called Stop(). Now I would like for some advice on how to close down the server in a gracefull manner. I tried
0
4454
by: amita | last post by:
I have a Client (a TcpClient object) established connection with the Server(a TcpListener). I want that when the Server goes down, the TcpClient detects this disconnection and when the Server is back up, client is able to establish connection again with the server. However when my server goes down, client socket goes in CLOSE_WAIT state and when server comes back and tries to reconnect server socket goes into FIN_WAIT state... can I not use...
13
4316
by: Joner | last post by:
Hello, I'm having trouble with a little programme of mine where I connect to an access database. It seems to connect fine, and disconnect fine, but then after it won't reconnect, I get the error "operation is not allowed when object is open" so I take out the line of code: BookDetails.Connection1.Open and it comes up with the error "operation is not allowed when object
0
1046
by: Macca | last post by:
Hi, I would like to write a "server" application that can run without a required GUI and just processes data. I would like to allow multiple "client" GUI winform apps to be able to "attach" to the server application through a common interface. These clients can attach and remove themselves without any side affects to the "server" app and may reside locally on the same PC or remotely on distributed PC's. I dont want to use windows...
1
3312
by: salvagedog | last post by:
We use xp_smtp_sendmail for all emailing from SQL Server. Occasionally it fails, generating the following message: Error: disconnecting from server mail.mydomain.com failed The failures are random, and there is no repeating pattern of symptoms. Any help would be greatly appreciated.
3
3232
by: =?Utf-8?B?UmludSBHb3BhbGFrcmlzaG5hIFBpbGxhaQ==?= | last post by:
Hi All, I have a ASP/C# application that connect to Oracle database . After issuing my SQL query if I close the browser or move into another page ( ie whle executing in the databse serevr) will the SQL execution in server continue or immediately stop.If it still continue how I can stop the execution (by disconnecting the present database connection ???). Please help.
0
8294
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8709
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8494
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.