Getting connection lost exception while inserting blob

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Guest

Getting connection lost exception while inserting blob

Post by Guest » Wed 05 Jan 2005 15:42

Hi all,

I downloaded the trial version of MySQLDirect .NET Data Provider (Version 2.70, MySQL 4.20). As soon as I trying to access a table with blob data types, I get a "Lost connection to MySQL server during query" exeption.

Is this a limitation of the trial edition?
See the code example below.
Notice: If I remove the "blob" part, the method works.

Code: Select all

		public void UploadBlob(string name,uint version, byte[] data) { 
			MySqlBlob myBlob = new MySqlBlob(data); 
			MySqlCommand myCommand = new MySqlCommand("INSERT INTO template (name,version,data) VALUES(name,version,:MyData)",mySqlConnection); 
			myCommand.Parameters.Add("MyData",myBlob); 
			mySqlConnection.Open(); 
			try { 
				myCommand.ExecuteNonQuery(); 
			} 
			finally { 
				mySqlConnection.Close(); 
			} 
		} 
Thanks for any help.
Toni

tonik
Posts: 2
Joined: Wed 05 Jan 2005 14:57

Same effect with 2.70.1.0

Post by tonik » Thu 06 Jan 2005 05:14

Hi all,

I do have the same effect with MySQL 4.1.8 and the newest MySQLDirect .Net Data Provider 2.70.1.0

Here's the table script, I try to access

Code: Select all

CREATE TABLE `template` (
  `Id` int(6) unsigned NOT NULL auto_increment,
  `name` varchar(255) NOT NULL default '',
  `version` int(4) unsigned NOT NULL default '0',
  `data` blob,
  PRIMARY KEY  (`Id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
[/code]

Oleg
Devart Team
Posts: 264
Joined: Thu 28 Oct 2004 13:56

Re: Same effect with 2.70.1.0

Post by Oleg » Thu 06 Jan 2005 11:48

Try to increase a value of max_allowed_packet variable at your server.
You can read about it in the documentation for MySQL.

tonik
Posts: 2
Joined: Wed 05 Jan 2005 14:57

solved

Post by tonik » Thu 06 Jan 2005 15:38

That did it! Thanks a lot.

Toni

Post Reply