Problem filing large blob objects

Problem filing large blob objects

Postby vosman » Tue 28 Mar 2006 18:47

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
vosman
 
Posts: 7
Joined: Tue 28 Mar 2006 18:41

Postby Alexey » Wed 29 Mar 2006 09:07

We are investigating this problem.
You'll be notified on results here on the forum.
P.S. Please specify how your application crashes.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Memory Error

Postby Guest » Wed 29 Mar 2006 22:44

The error that happens is :

Exception of type System.OutOfMemoryException was thrown.

This is what happens on files bigger than 100megs.

Thanks
Brad
Guest
 

Postby vosman » Tue 22 Jul 2008 14:26

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
vosman
 
Posts: 7
Joined: Tue 28 Mar 2006 18:41

Postby AndreyR » Thu 24 Jul 2008 16:26

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.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby vosman » Thu 24 Jul 2008 17:05

twice the memory on the client pc doing the uploading?
vosman
 
Posts: 7
Joined: Tue 28 Mar 2006 18:41

Postby vosman » Thu 24 Jul 2008 17:34

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
vosman
 
Posts: 7
Joined: Tue 28 Mar 2006 18:41

Postby vosman » Wed 30 Jul 2008 19:29

any chance for this to be looked into?
vosman
 
Posts: 7
Joined: Tue 28 Mar 2006 18:41

Postby AndreyR » Thu 31 Jul 2008 14:17

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.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby vosman » Thu 31 Jul 2008 16:10

Thank you for the response, I will look into the server hosting MySQL.
vosman
 
Posts: 7
Joined: Tue 28 Mar 2006 18:41


Return to dotConnect for MySQL