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

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 2543
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.com

"John J. Hughes II" <no@invalid.com> wrote in message
news:Op**************@TK2MSFTNGP11.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.com> wrote in
message news:ew**************@tk2msftngp13.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.com

"John J. Hughes II" <no@invalid.com> wrote in message
news:Op**************@TK2MSFTNGP11.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 misunderstanding 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*******@yahoo.nospammin.com> wrote in message
news:6C**********************************@microsof t.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$**************@tk2msftngp13.phx.gbl...
Oh, maybe I am misunderstanding 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*******@yahoo.nospammin.com> wrote in message
news:6C**********************************@microsof t.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**************@TK2MSFTNGP10.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$**************@tk2msftngp13.phx.gbl...
Oh, maybe I am misunderstanding 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*******@yahoo.nospammin.com> wrote in
message news:6C**********************************@microsof t.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
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...
0
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;...
2
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...
7
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. ...
0
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...
13
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...
0
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...
1
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...
3
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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...

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.