Updating a remote mysql database from an ASP.NET server

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Posts: 1
Joined: Wed 07 Mar 2012 01:38

Updating a remote mysql database from an ASP.NET server

Post by mquintana » Wed 07 Mar 2012 01:56

I'm trying to update a remote MySql database (hosted in a shared php/Linux server) from another server running ASP.NET but sometimes I'm getting this error:

Lost connection to MySQL server during query

I guess it ISN'T closing each connections correctly.. then when they are opened again it crashes because the max pool of connections allowed in the server or even by the timeout, I don't know

I'm using a custom component to establish mysql remote connections: Devart.Data.MySql

This code is executed within a loop... part of the code is disabled..

strSQL2 = "INSERT INTO table (order_no, nolic) VALUES (" & nMax & ",'" & Buffer & "')"

Dim conn5 As New Devart.Data.MySql.MySqlConnection("Host=;Port=3306;Database=myDatabase; User Id=myId;Password=myPass;")

'conn5.ConnectionTimeout = 3600

Dim cmd6 As New Devart.Data.MySql.MySqlCommand(strSQL2, conn5)

cmd6.ExecuteNonQuery() ----> HERE THE ERROR

Catch ex As System.Exception
SendMailOnError(ex.ToString, "2")


' conn3.Dispose()
End Try

After running this code I create/open a new connection and execute an INSERT INTO to another table in the same database then continue with the next iteration.

How can I solve this error?

Devart Team
Posts: 2138
Joined: Wed 02 Nov 2011 09:44

Post by Pinturiccio » Fri 16 Mar 2012 07:56

We could not reproduce the issue. Could you please specify the following:
1. Exception stack traсe;
2. The fragment of the code with the whole cycle;
3. Does the issue persist if you use Pooling=False in ConnectionString? If turning pooling off helps, you can try using pooling with the Validate Connection option: "Pooling=true;Validate Connection=true;".
4. dotConnect for MySQL version (x.xx.xxx) and MySQL server version.

Post Reply