Description:
I'm getting the following error when I try to make a Query on MySQL:
ERROR [HY000] [MySQL][ODBC 3.51 Driver][mysqld-4.1.9-standard-log]Lost connection to MySQL server during query
I'm using ASP.NET with MySQL Server.
Version of Microsoft.Data.Odbc.dll: 1.0.4030.0
Version of MyODBC: 3.51.06
Version of MySQL Server: 4.1.9
Version of OS: Linux
MySQL Server is configured to kill all unused connections after 15 seconds.
I use the following code on my .NET page.
---------------
Imports microsoft.Data.Odbc
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim oConexao As OdbcConnection
Dim oCmd As OdbcCommand
Dim oReader As OdbcDataReader
oConexao = New OdbcConnection()
oConexao.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=xxx.xxx.xxx.xxx;DATABASE=Mysql;UID=User;PWD=Password;"
oConexao.Open()
oCmd = New OdbcCommand("SELECT * FROM TABLE", oConexao)
oReader = oCmd.ExecuteReader
oReader.Close()
oConexao.Close()
oCmd = Nothing
oReader = Nothing
oConexao = Nothing
End Sub
---------------
Steps to get the erro:
Run de Testconnection.ASPX (with the above code)
On MySql Administrator, under Server Connections Tab I can see a new Thread.
I keep reloading the page while the Thread is still on the list, it runs without ERROR.
But if I Reload the page after the Thread is automatic killed - if I press Refresh Button, I can see the Time Column increasing until 15, after 15 the thread disappears and then I reload the Page, and it returns The ERROR
showed in the begining of the description.
I Hope I could explain the problem, and that you can Help,
Hope to hear from you soon,
Thiago
How to repeat:
Imports microsoft.Data.Odbc
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim oConexao As OdbcConnection
Dim oCmd As OdbcCommand
Dim oReader As OdbcDataReader
oConexao = New OdbcConnection()
oConexao.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=xxx.xxx.xxx.xxx;DATABASE=Mysql;UID=User;PWD=Password;"
oConexao.Open()
oCmd = New OdbcCommand("SELECT * FROM TABLE", oConexao)
oReader = oCmd.ExecuteReader
oReader.Close()
oConexao.Close()
oCmd = Nothing
oReader = Nothing
oConexao = Nothing
End Sub
---------------
Steps to get the erro:
Run de Testconnection.ASPX (with the above code)
On MySql Administrator, under Server Connections Tab I can see a new Thread.
I keep reloading the page while the Thread is still on the list, it runs without ERROR.
But if I Reload the page after the Thread is automatic killed - if I press Refresh Button, I can see the Time Column increasing until 15, after 15 the thread disappears and then I reload the Page, and it returns The ERROR
showed in the begining of the description.
I Hope I could explain the problem, and that you can Help,
Hope to hear from you soon,
Thiago