Storing files in Blob Field

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
waheed
Junior Boarder
Junior Boarder
Posts: 26
Joined: 18.11.2005, 21:41

Storing files in Blob Field

Post by waheed »

I'm trying to store a 2,737,152 bytes file in a MidiumBlob column. But after loading and then I post the record I get "SQL Error: MySQL Server has gone away." and the record is not saved.
I don't know where it went!! :wink:

But really why did it go away?

BTW: I'm able to save size with less that 1M files, even when I change the field to LongBlob it didn't work.

MySQL 5.0.20a
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Two possibilities I can imagine.
- Mysql bug/incompatibility with your DLL version and server version. Very difficult to find that.
- Something wrong in our blob handling. It's possible we do some wrong function calls when passing the blob's to the dll. Maybe we have to pass smaller parts to the server, or something like that.

I would appreciate if you could make the smallest possible project which causes your server to run away in fear and zip everything together in a bug report on zeosbugs.firmos.at . Please include everything : table create, blob data and project. Don't forget to mention if you are using the dll in the zeos distribution or the one belonging to your server distribution.

Mark
waheed
Junior Boarder
Junior Boarder
Posts: 26
Joined: 18.11.2005, 21:41

Post by waheed »

Solution was simplerer.
MySQL max_allowed_packet variable was set to 1MB. I changed it to 3MB and the problem was solved.

Thanks
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Waheed,

I'm not a big 'blobber'. Do you think this is the definite solution or could we change our blob handling to take smaller packet size limits into account? eg by checking max_allowed_package size first time a blob is sent to a server?

I suppose your solution implies setting the max_allowed_packet variable to the maximum blob size you expect? Or is it just that the maximum packet size we use is somewhere between 1 and 3 MB?

Mark
waheed
Junior Boarder
Junior Boarder
Posts: 26
Joined: 18.11.2005, 21:41

Post by waheed »

The max_allowed_packet can be any number. But it needs a server restart to be effective.

As for changing your components to handle large packets, I don't know if it would worth the effort, but it would be better.

Thanks
Post Reply