Aborted connection (Got an error reading communication packet)

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Posts: 1
Joined: Thu 27 Apr 2006 23:48

Aborted connection (Got an error reading communication packet)

Post by JBDev » Fri 28 Apr 2006 00:02

[/code]Get this MySQL error in the Application event viewer for the following console application. (Aborted connection - got an error reading communication packet)[/quote]

Code: Select all

Imports CoreLab.MySql
Imports System.IO

Module DataTable

    Sub Main()
        Dim strFileName As String = "C:\Export.txt"

        Dim intLoop As Integer
        Dim strString As String
        Dim strSql As String

        ' Delete the file if it exists.
        If File.Exists(strFileName) Then
        End If

        'Create the file.
        Dim objFileOpen As FileStream = File.Create(strFileName)
        Dim objFileWrite As StreamWriter = New StreamWriter(objFileOpen)

        'Build table
        strSql = "SELECT AssociateNumber, CardNumber, NameFirst, NameLast, Department, JobCode FROM Associate"
        Dim dtAssociate As MySqlDataTable = New MySqlDataTable(strSql, "Host=localhost;Port=3306;User ID=root;Password=$4JBDev@ds;Database=Express")
            dtAssociate.Active = True
            For intLoop = 0 To dtAssociate.Rows.Count - 1
                strString = dtAssociate.Rows(intLoop)(0).ToString.PadLeft(12) & "," & _
                            dtAssociate.Rows(intLoop)(1).ToString.PadLeft(2, "0") & "," & _
                            dtAssociate.Rows(intLoop)(2).PadRight(14) & "," & _
                            dtAssociate.Rows(intLoop)(3).PadRight(20) & "," & _
                            dtAssociate.Rows(intLoop)(4).PadRight(10) & "," & _
            dtAssociate.Active = False
        End Try
    End Sub

End Module

Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Fri 28 Apr 2006 06:32

Add Pooling=false attribute to the ConnectionString argument.
We also recommend to use MySqlDataReader instead of MySqlDataTable in order to not store all fetched records in the working memory.

Posts: 2
Joined: Thu 08 May 2008 12:59

Post by jackkenyon » Sat 09 May 2009 05:34

To Alexey

I am also getting these errors intermittently from mysql server. I have set Connection.Pooling=FALSE. Is this the same thing?
I also found a reference saying that components can only be used by one thread. Does this include the TMySqlUniProvider and the TUniConnection components?


Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 13 May 2009 16:00

We recommend you to use the separate TUniConnection object for every thread.

Post Reply