MySQL Forums
Forum List  »  Connector/ODBC

MySQL ODBC Connector *8.0.23* 'Malformed communication packet' with ADO.NET DataAdapter
Posted by: Josip Pantovic
Date: February 02, 2021 07:21AM

Case: ADO.NET DataAdapter, inserting a new row containing long text to be inserted into a %TEXT column, without specifying values for columns after it.

Sample code below fails with MySQL ODBC Connector 8.0.23 connecting to 8.0.23 server, due to:
ERROR [HY000] [MySQL][ODBC 8.0(w) Driver][mysqld-8.0.23]Malformed communication packet.

It works as expected when:
- using MySQL ODBC Connector 8.0.22 with 8.0.23 server
- using MySQL ODBC Connector 8.0.23 with an earlier server version
- text length is <= 8183.

Connector 8.0.23 bug?



public void TestOdbc8023_DataSet()
{
string longText = "";
for (int i = 0; i < 8184; i++)
longText += "a";

using (var conn = new System.Data.Odbc.OdbcConnection("DSN=VM"))
{
conn.Open();

// Create table
var createTableSql =
@"CREATE TABLE IF NOT EXISTS test_malformed (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name MEDIUMTEXT NOT NULL,
deleted TINYINT DEFAULT NULL
) Engine=InnoDB;";

using (var cmd = new System.Data.Odbc.OdbcCommand(createTableSql, conn))
{
cmd.ExecuteNonQuery();
}

// Setup adapter + DatSet
using (var adapter = new System.Data.Odbc.OdbcDataAdapter("SELECT * FROM test_malformed WHERE 1 = 0", conn))
using (var builder = new System.Data.Odbc.OdbcCommandBuilder(adapter))
{
var dataTable = new System.Data.DataTable("test_malformed");
adapter.Fill(dataTable);

// insert
var row = dataTable.NewRow();
row["name"] = longText;
dataTable.Rows.Add(row);

adapter.Update(dataTable);
}
}
}

Options: ReplyQuote


Subject
Written By
Posted
MySQL ODBC Connector *8.0.23* 'Malformed communication packet' with ADO.NET DataAdapter
February 02, 2021 07:21AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.