Copy link to clipboard
Copied
I originally posted this AIR question on the Flex forum, which didn't get much attention, so now I am trying here which seems more ideal.
My question in detail:
Would it be more optimal to store binaries (Images and SWFs) as BLOBs in the database or to have a URI pointing to them on the user’s file system?
I am primarily a Flex developer which hasn't had much development time with databases but realizes there are 2 options to take for storing binaries in an AIR application. Since I haven't been exposed to db development I am not sure which is the preferred way.
You are right there are two options, and they are both commonly used.
Storing on the file system is a bit easier to implement for many and might be a touch more proformant with less encoding and decoding going on. But it has a higher risk of syncornazation problems since there are many ways for the file objects to be modified, moved or removed without changing anything and the database. Thus one should build logic that will check for the actual existence of the file at the URI before trying to
...Copy link to clipboard
Copied
You are right there are two options, and they are both commonly used.
Storing on the file system is a bit easier to implement for many and might be a touch more proformant with less encoding and decoding going on. But it has a higher risk of syncornazation problems since there are many ways for the file objects to be modified, moved or removed without changing anything and the database. Thus one should build logic that will check for the actual existence of the file at the URI before trying to serve it up.
Storing the file in the database mitigates the issues with syncornazation. But it takes a bit more to set up and could involve a lot more data in the database itself, which may or may not be an issue depending on ones setup.
But either is an acceptiable choice and just work with the various pros and cons of either.
Copy link to clipboard
Copied
ilssac, thanks for the feedback!
I think I am going to try to save the binaries directly in the database. Saving a binary on the file system would involve 2 easy steps: storing the URI in the db and saving the binary on the file system. But as you mentioned there are risks involved.
I started this task yesterday and I am saving BLOBs to the db, but will now just need to decode them when requested. If the performance is good when decoding them, I believe I will stay with this option. If not, I will resort to storing them on the file system.
Thanks again.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now