Re: connections in sleep state
Posted by: Reggie Burnett
Date: August 31, 2006 08:30AM

Dante

You are seeing the affects of Connection pooling. When using pooling, it is correct behavior to see the connection sleeping at the server end after you do a close. However, if you open a new connection with the exact same connection string, it should reuse that connection. See the code below.


string connStr = "server=myserver; blah; blah";
for (int i=0; i < 100; i++)
{
MySqlConnection c = new MySqlConnection(connStr);
c.Open();
.... do something with c.....
c.Close();
}

When all this is done, you should have only 1 connection at the server side and it will be sleeping. If you have 100 connections, then there is a bug in pooling that I need to address.

If you do not want to use pooling, then you can add pooling=false to your connection string.

Reggie

Options: ReplyQuote


Subject
Written By
Posted
January 19, 2006 02:13AM
February 02, 2006 12:03PM
February 03, 2006 12:22PM
September 01, 2006 03:51AM
Re: connections in sleep state
August 31, 2006 08:30AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.