Bug #64766 Unable Close Connection For Active Connection
Submitted: 26 Mar 2012 15:12 Modified: 28 Apr 2012 23:10
Reporter: Heng G Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.5.4 OS:Other (Windows 7)
Assigned to: CPU Architecture:Any

[26 Mar 2012 15:12] Heng G
Description:
On C#, i try to open connection between mysql server.

it's fine, after finish query. After apply conn.close function but seen like not working.

I check on phpmyadmin control panel, proccess is showing connection is still active. After i close entire program, connection between mysql server only disconnect.

How to repeat:
When connection is open, it will keep connection active until program fully close.
[26 Mar 2012 16:15] Valeriy Kravchuk
Please, provide complete code that demonstrates the problem.
[27 Mar 2012 9:46] Heng G
private void nonQueryGo_Click(object sender, System.EventArgs e)
		{

string connStr = "server=localhost;uid=root;pwd=123;database=lyc_g01;";
conn = new MySqlConnection(connStr);

try 
{
   conn.Open();
string sql = "UPDATE Customer SET ID=0";
cmd = new MySqlCommand(sql, conn);
cmd.ExecuteNonQuery();
conn.Close();			

}catch (Exception ex){
         MessageBox.Show("Exception: " + ex.Message);
}
[28 Mar 2012 23:10] Fernando Gonzalez.Sanchez
Hi Heng,

By default, Connector/NET pools the connections, and the pool is cleaned when the assembly is unloaded (ie. the app finishes in your example).

If you add "pooling=false" to the connection string, you should no longer see the connection with phpadmin or issuing "show processlist" in the server.

Usually for better performance you would like to enable pooling.

Let us know if that solves your issue.

Thanks.
[29 Apr 2012 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".