Blob Storage, DB looses connection

Blob Storage, DB looses connection

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

file_data LONGBLOB DEFAULT NULL

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;
uCmd.ExecuteNonQuery();

Any suggestions of what I might be doing wrong?

Thanks for your help.
wavelet
 
Posts: 2
Joined: Thu 04 Jun 2009 17:35
Location: Colorado

Postby Shalex » Fri 05 Jun 2009 10:44

We will investigate the issue and notify you about the results as soon as possible.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Fix for blob store size

Postby 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.
wavelet
 
Posts: 2
Joined: Thu 04 Jun 2009 17:35
Location: Colorado


Return to dotConnect Universal