Bug #8393 Lost connection to MySQL server during query
Submitted: 9 Feb 2005 14:18 Modified: 9 Feb 2005 16:26
Reporter: Thiago Madeira Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.06 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[9 Feb 2005 14:18] Thiago Madeira
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
[9 Feb 2005 16:26] Jorge del Conde
Thank you for taking the time to report a problem.  Unfortunately
you are not using a current version of the product your reported a
problem with -- the problem might already be fixed. Please download
a new version from http://www.mysql.com/downloads/

If you are able to reproduce the bug with one of the latest versions,
please change the version on this bug report to the version you
tested and change the status back to "Open".  Again, thank you for
your continued support of MySQL.