Bug #14675 problems calling MySqlCommand.ExecuteNonQuery(), cannot socket connect
Submitted: 5 Nov 2005 23:21 Modified: 15 Nov 2005 18:34
Reporter: juan cesar Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.6 OS:Microsoft Windows (WinXP)
Assigned to: Bugs System CPU Architecture:Any

[5 Nov 2005 23:21] juan cesar
Description:
I call a simple store procedure without parameters that inserts a row and a exception ocurrs, this the error message. (Note: I have checked the insertion direct from the IDE and there is not problem).

MySql.Data.MySqlClient.MySqlException: Se ha anulado una conexión establecida por el software en su equipo host ---> System.Net.Sockets.SocketException: Se ha anulado una conexión establecida por el software en su equipo host
   at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at MySql.Data.Common.SocketStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   --- Fin del seguimiento de la pila de la excepción interna ---
   at MySql.Data.Common.SocketStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.BufferedStream.FlushWrite()
   at System.IO.BufferedStream.Flush()
   at MySql.Data.MySqlClient.PacketWriter.FlushBuffer()
   at MySql.Data.MySqlClient.PacketWriter.Flush()
   at MySql.Data.MySqlClient.NativeDriver.Authenticate411()
   at MySql.Data.MySqlClient.NativeDriver.Authenticate()
   at MySql.Data.MySqlClient.NativeDriver.Open()
   at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionString settings)
   at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.GetConnection()
   at MySql.Data.MySqlClient.MySqlPoolManager.GetConnection(MySqlConnectionString settings)
   at MySql.Data.MySqlClient.MySqlConnection.Open()
   at ADONETconSharp.Ejercicio004.btnCallPRO_Cadenas_Click(Object sender, EventArgs e) in f:\soluciones\adonetconsharp\ejercicio004.cs:line 274

How to repeat:
run this:

string strCnx = "data source=localhost; database=northwind_dbo; uid=root; pwd=_mysqlFoo;";

            MySqlConnection cnx = new MySqlConnection(strCnx);
            try {
                MySqlCommand cmdTemp = new MySqlCommand("insertar", cnx);
                cmdTemp.CommandType = CommandType.StoredProcedure;
                cmdTemp.Connection.Open();
                cmdTemp.ExecuteNonQuery();
                cmdTemp.Connection.Close();
            } catch(MySqlException sos) {
                System.Diagnostics.Debug.WriteLine(sos.ToString());
            }

the store procedure is like this:  THIS RUNS OK, BUT ANYWAY JOIN THIS:

DELIMITER $$

DROP PROCEDURE IF EXISTS `northwind_dbo`.`insertar` $$
CREATE PROCEDURE `northwind_dbo`.`insertar` ()
BEGIN
  insert into region(regionID, regionDescription) values ('5', 'nueva region');
END $$

DELIMITER ;

Suggested fix:
 I have no idea. :)
[6 Nov 2005 11:06] Vasily Kishkin
Sorry...I was not able to reproduce the bug. Could you please say me what version of mysql you use ?
[6 Nov 2005 15:11] juan cesar
the version is 5.0.15.
[6 Nov 2005 19:58] juan cesar
Bug #14675 = Bug #14631, the same exception message
[8 Nov 2005 11:33] Vasily Kishkin
Could you please say me you use .NET 1.0 or .NET 1.1 ?
[8 Nov 2005 19:58] juan cesar
NET 1.1
[9 Nov 2005 2:15] juan cesar
It was me
[15 Nov 2005 11:43] Oscar Acosta
So, what is the solution to avoid this????
[15 Nov 2005 18:34] juan cesar
Oscar Acosta, do you speak spanish??  
It was de IDE, I think... I have repeated de bug with a Borland C# IDE and there is not problem. Also, I have tried run the .exe direct from the windows explorer (not from the IDE with F5), and there is not problem either. So, I decided not bother again :).

Creo que es el entorno de programación del .NET, he reproducido el error en otro entorno (en el de Borland C#) y no hay problema alguno. Tambien, si corres el ejecutable que te genera tampoco hay problema y no te sale ese mensaje de error.
Asi que, por ahora (aunque es algo incomodo), compilo desde el entorno, pero ejecuto directamente desde el ejecutable :).  Nos vemos Oscar.