Blob Storage, DB looses connection

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for universal data access
Post Reply
Posts: 2
Joined: Thu 04 Jun 2009 17:35
Location: Colorado

Blob Storage, DB looses connection

Post by wavelet » Thu 04 Jun 2009 17:57

I am trying to store 8 MB video files in a MySQL db using UniBlob and the method outlined in the UniDirect tutorial for blob storage. The blob storage works for small data files, 10K or so, but when I try to store a 8MB video file, I receive an "Database lost connection" error message.

The data item in the MySql table is defined as:


The code for storing the video file is (C# .NET):

FileStream fs = new FileStream(blobFilename, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
int streamLength = (int)fs.Length;

UniBlob uniBlob = db.getUniBlob();
uniBlob.Write(r.ReadBytes(streamLength), 0, streamLength);

string cmdString = "INSERT INTO eventData ";
cmdString += "(event_id, file_data) ";
cmdString += "VALUES(";
cmdString += "'" + eventList.eventID.ToString() + "',";
cmdString += ":file_data)";

UniCommand uCmd = db.GetCommand(cmdString, CommandType.Text);
UniParameter myParam = uCmd.Parameters.Add("file_data", UniDbType.Blob);
myParam.Value = uniBlob;

Any suggestions of what I might be doing wrong?

Thanks for your help.

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

Post by Shalex » Fri 05 Jun 2009 10:44

We will investigate the issue and notify you about the results as soon as possible.

Posts: 2
Joined: Thu 04 Jun 2009 17:35
Location: Colorado

Fix for blob store size

Post by wavelet » Sun 14 Jun 2009 05:16

The issue to the blob store size is a MySQL config parameter: max_allowed_packet = 1M in the my.ini file. This 1 megabyte setting was limiting the size of the blob I could store. Increasing the size on this parameter to something larger than the largest blob size to be stored fixed the problem.

Post Reply