Page 1 of 1

Getting connection lost exception while inserting blob

Posted: Wed 05 Jan 2005 15:42
by Guest
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

Same effect with 2.70.1.0

Posted: Thu 06 Jan 2005 05:14
by tonik
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]

Re: Same effect with 2.70.1.0

Posted: Thu 06 Jan 2005 11:48
by Oleg
Try to increase a value of max_allowed_packet variable at your server.
You can read about it in the documentation for MySQL.

solved

Posted: Thu 06 Jan 2005 15:38
by tonik
That did it! Thanks a lot.

Toni