Storing large binaries into the database

For questions and postings not covered by the other forums
itopcin
Posts: 2
Joined: Thu Oct 01, 2009 2:30 pm

Storing large binaries into the database

Postby itopcin » Mon Apr 12, 2010 7:33 pm

Hi there,

I've had this problem before, and today it came up again to haunt me once more :)
I have to load a big file into the database, but I keep getting a 1018 (no memory for buffers exception) whenever the file is bigger than the transient or persistent cache size.

I've already tried to read the file in chunks and assign the small bits to my object's binary property, but I still get the same exception (which is understandable, given that jade has to keep it in memory before the transaction is committed / rolled back). PS: The property type is Binary, and the object is a persistent object.

So, the question is: is there a solution for that?

Thanks!
Igor

kevinnz
Posts: 3
Joined: Tue Oct 27, 2009 2:21 pm

Re: Storing large binaries into the database

Postby kevinnz » Mon Apr 12, 2010 8:42 pm

Hi

Have you check out the JadeBytes class? That may well do what you need.

Kevin

itopcin
Posts: 2
Joined: Thu Oct 01, 2009 2:30 pm

Re: Storing large binaries into the database

Postby itopcin » Tue Apr 13, 2010 12:36 am

Thanks Kevin, that worked pretty well.
I simply used JadeBytes::loadFromFile and JadeBytes::extractFromFile. All the hard work was done by Jade :)

Cheers
Igor

allistar
Posts: 156
Joined: Fri Aug 14, 2009 11:02 am
Location: Mount Maunganui, Tauranga

Re: Storing large binaries into the database

Postby allistar » Tue Apr 13, 2010 8:24 am

A solution to this problem without using JadeBytes is to use multiple objects to represent the binary, each object getting, say, 5Mb of the binary each.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 18 guests

cron