Problem filing large blob objects
Problem filing large blob objects
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
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
Memory Error
The error that happens is :
Exception of type System.OutOfMemoryException was thrown.
This is what happens on files bigger than 100megs.
Thanks
Brad
Exception of type System.OutOfMemoryException was thrown.
This is what happens on files bigger than 100megs.
Thanks
Brad
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.
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
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.
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.