Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection pooling

Status
Not open for further replies.

Spyrios

Technical User
Jan 24, 2004
22
US
How long typically should a connection remain in the pool after it has been closed? If I remember right I've read somewhere about 60 -90 seconds. But my connection is hanging on for about 8 minutes! My code is pretty simple, something like this:

cmd = cnn.createcommand;
cmd.commandtext = "select..";

da.fill(ds, "Table1");
cnn.close();

-- and I've tried
cnn.dispose();


I'm wanting to kill the connection within at least 60 seconds if it's not actively working. I don't care so much about the performance on the client side (they can wait an extra second here or there). I do want to keep the server from being bogged down with connections. In this situation it's not that important, but I do want to know how to immediately kill the connection if it was a mission critical type of operation. What am I missing here?


thanks,

Michael
 
I wouldn't worry about it -- the pool is there to provide fast access to a DB connection. As you've found, the pool will eventually shrink, so you'll eventually reclaim any unused connections.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
You create a Connection object when you need to connect to a database.
->The connection is realized only when Open() is successful.
->While the connection is in the Open state you can perform database tasks.
->Also you can change the database without closing the connection (Close()).
->Call Close() when you finish the database tasks ( retrive data, update database).
->Do not keep the connection open if there is no immediate need to access the database.
->Calling Close () will roll back any pending transactions, release the connection to the connection pool, or close the connection if connection pooling is disabled.
That means it is marked to be released but you have no control when will be released.
->Can call Close() more than one time without any problem.
->When you need to activate the connection, check the State property of the connection object.
Perform actions depending on the State e.g. If State is Closed then you can try to open.
There are also Connecting, Broken, Executing, Fetching states.
->When there is no need for the connection object then call Dispose():
if (oConn !=null)
{
oConn.Close();
oConn.Dispose();
oConn=null;
}
-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top