Aborted connection (Got an error reading communication packet)

Aborted connection (Got an error reading communication packet)

Postby 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
            File.Delete(strFileName)
        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")
        Try
            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.Rows(intLoop)(5).PadRight(6)
                objFileWrite.WriteLine(strString)
            Next
        Finally
            dtAssociate.Active = False
        End Try
        objFileWrite.Close()
    End Sub

End Module


[/code]
JBDev
 
Posts: 1
Joined: Thu 27 Apr 2006 23:48

Postby 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.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby 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?

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

Postby Shalex » Wed 13 May 2009 16:00

We recommend you to use the separate TUniConnection object for every thread.
Shalex
Devart Team
 
Posts: 7606
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for MySQL