Blob和文件之间的区别

时间:2022-03-18 03:46:00

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?

将文件(例如AVI)保存为数据存储区中的Blob与将其保存为网络服务器上的普通AVI文件有什么区别?

Thanks!

Joel

3 个解决方案

#1


5  

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.

保存在服务器上的文件将是通常的文件系统文件。但是,在数据库中,它们具有用于保存数据的表。因此,当您想要在数据库中保存文件时,有一个特殊字段是二进制大对象(BLOB)字段。这允许将字节流存储到数据库中,就像任何其他字段一样。它不存储文件的类型以及文件系统可能维护的任何其他属性。从数据库读回时,您必须知道文件的类型。通常将其存储在同一个表中的其他文本字段中。

#2


0  

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.

例如。如果放在FS中,它可以被轻易删除或替换。另一方面,在某些情况下,从DB存储和检索它是不可接受的。

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

当然,有很多事情要考虑。你没有清楚地问你最感兴趣的是什么。

#3


0  

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?

以下是Microsoft Research的一篇文章,主题是将大对象存储在数据库中,而不是将它们存储在文件系统中。从2006年开始,但可能是一个起点?

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

#1


5  

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.

保存在服务器上的文件将是通常的文件系统文件。但是,在数据库中,它们具有用于保存数据的表。因此,当您想要在数据库中保存文件时,有一个特殊字段是二进制大对象(BLOB)字段。这允许将字节流存储到数据库中,就像任何其他字段一样。它不存储文件的类型以及文件系统可能维护的任何其他属性。从数据库读回时,您必须知道文件的类型。通常将其存储在同一个表中的其他文本字段中。

#2


0  

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.

例如。如果放在FS中,它可以被轻易删除或替换。另一方面,在某些情况下,从DB存储和检索它是不可接受的。

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

当然,有很多事情要考虑。你没有清楚地问你最感兴趣的是什么。

#3


0  

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?

以下是Microsoft Research的一篇文章,主题是将大对象存储在数据库中,而不是将它们存储在文件系统中。从2006年开始,但可能是一个起点?

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