views:

54

answers:

3

Hey!

What is the difference between saving a file (e.g. AVI) as a Blob in the datastore to saving it as a normal AVI file on a webserver?

Thanks!

Joel

A: 

E.g. it could be deleted or replaced easily if placed in the FS. On the other hand, storing and retrieving it from a DB could not be acceptable in certain scenarios.

Of course, there are many things to think about. You did not clearly ask what are you mostly interested in.

thelost
+3  A: 

A file saved in on the server will be a usual file system file. But, in databases they have tables to save data. So, when you want to save a file in a database, there is a special field which is Binary Large Objects (BLOB) field. Which allows a stream of bytes to be stored into the database just like any other fields. It does not store what type of the file is and any other attributes that the file system may be maintaining. You must know the type of file when reading back from database. Which is usually stored into some other text field into the same table.

decyclone
Usually the file's mimetype is stored within its bytecode so it is technically possible to retrieve the type even if you don't maintain it separately.
Swizec Teller
A: 

Here's an article from Microsoft Research on the subject of storing large objects in a database vs. storing them on a filesystem. From 2006, but could be a starting point?

http://research.microsoft.com/apps/pubs/default.aspx?id=64525

Dev F