Bug #31010 Problem to close connection using Driver .Net
Submitted: 14 Sep 2007 0:26 Modified: 21 Sep 2007 22:33
Reporter: Rigel Aguilar Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:MySql.Data.dll 5.1.2.2 OS:Any (Don't close connection)
Assigned to: CPU Architecture:Any
Tags: Close Connection

[14 Sep 2007 0:26] Rigel Aguilar
Description:
I'm using the Driver MySql.Data.dll 5.1.2.2 to work with .Net, but when I use the command ".CLOSE();" on the connection object, its doesn't close the connection.
I'm using tool MySQL Administrator to see the connections opened.

How to repeat:
How to repeat this problem, use the follow code.

protected void Page_Load(object sender, EventArgs e)
{
        MySqlConnection c = new MySqlConnection("Data Source=127.0.0.1; user id=root; password=mypassword; initial catalog=MyDataBaseName;");
        c.Open();
        c.Close();
        c.Dispose();
}

Suggested fix:
Close the connection.
[21 Sep 2007 22:33] Reggie Burnett
This is not a bug.  Connection pooling is on by default.  If you want the connection to mysql to actually die when you call close, add 'pooling=false' to your connection string.
[25 Sep 2007 19:54] Jason Edelman
I've had pooling=false set for the past 2 years or so and connections don't die when I use .Close().