Page 1 of 1

Problem filing large blob objects

Posted: Tue 28 Mar 2006 18:47
by vosman
I am currently filing blob object into an MySQL database with the following code:


Dim FS As FileStream = New FileStream(ThePath, FileMode.Open, FileAccess.Read)
Dim BR As BinaryReader = New BinaryReader(FS)
Dim myBlob As MySqlBlob = New MySqlBlob(BR.ReadBytes(Convert.ToInt32(FS.Length)))
MySQLCommand.CommandText = SP.DataFiles_ins(DocFileID, Parser.ParseExtension(ThePath, True))
MySQLCommand.Parameters.Add("TheBlob", myBlob)
MySQLConnection.Open()
Try
Console.WriteLine(String.Concat(MySQLCommand.ExecuteNonQuery(), " rows affected."))
Finally
MySQLConnection.Commit()
MySQLConnection.Close()
BR.Close()
End Try

This routine works great until I try to file a document over 100megs in size. It crashes!!

Is this a limitation of MySQLDirect.Net or am I doing something wrong? If so how should I send large blob objects to the MySQL database?

Thanks
Brad

Posted: Wed 29 Mar 2006 09:07
by Alexey
We are investigating this problem.
You'll be notified on results here on the forum.
P.S. Please specify how your application crashes.

Memory Error

Posted: Wed 29 Mar 2006 22:44
by Guest
The error that happens is :

Exception of type System.OutOfMemoryException was thrown.

This is what happens on files bigger than 100megs.

Thanks
Brad

Posted: Tue 22 Jul 2008 14:26
by vosman
Having this problem again but now with files around 200 MB in size. I am using MyDirect .NET Ver. 4.25.22.0

Here is the code i am using to insert these large blobs.

Code: Select all

    Public Sub UploadDocFileBlob(ByVal ThePath As String, ByVal DocFileID As String)
        Dim Parser As New Parser
        Dim FS As FileStream = New FileStream(ThePath, FileMode.Open, FileAccess.Read)
        Dim BR As BinaryReader = New BinaryReader(FS)
        Dim myBlob As New MySqlBlob(BR.ReadBytes(Convert.ToInt32(FS.Length)))
        MySQLCommand.CommandText = SP.DataFiles_ins(DocFileID, Parser.ParseExtension(ThePath, True))
        MySQLCommand.Parameters.Add("TheBlob", myBlob)
        MySQLConnection.Open()
        '-- 
        Try
            Console.WriteLine(String.Concat(MySQLCommand.ExecuteNonQuery(), " rows affected."))
        Finally
            MySQLConnection.Commit()
            MySQLConnection.Close()
            FS.Flush()
            FS.Close()
            FS.Dispose()
            BR.Close()
            myBlob.Flush()
            myBlob.Close()
        End Try
    End Sub

Posted: Thu 24 Jul 2008 16:26
by AndreyR
Hello, Vosman.

When inserting a BLOB into the MySQL database with MyDirect .NET, there should be at least twice more free memory for success.
That is the cause of the exception.

Regards, Andrey.

Posted: Thu 24 Jul 2008 17:05
by vosman
twice the memory on the client pc doing the uploading?

Posted: Thu 24 Jul 2008 17:34
by vosman
I do not believe that to be a correct statement. I have a pc that has 3.5 GB of ram installed and the taskmanager says it has almost 3 GBs of free memory but yet i still cannot upload a 200 MB blob

Posted: Wed 30 Jul 2008 19:29
by vosman
any chance for this to be looked into?

Posted: Thu 31 Jul 2008 14:17
by AndreyR
After some more testing we found out that the machine where MySQL server is hosted requires much more free RAM to success the BLOB insert.
We inserted a 100MB BLOB and the process needed 600 MB RAM on server.
So please check that the server machine has enough memory.
But the investigation is still in progress. We will let you know if there is any news.

Posted: Thu 31 Jul 2008 16:10
by vosman
Thank you for the response, I will look into the server hosting MySQL.