Blob 和文件之间的区别
将文件(例如 AVI)保存为数据存储中的 Blob 与将其保存为 Web 服务器上的普通 AVI 文件之间有什么区别?
谢谢!
乔尔
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
保存在服务器上的文件将是普通的文件系统文件。但是,在数据库中,它们有表来保存数据。因此,当您想要将文件保存到数据库中时,有一个特殊字段,即
二进制大对象(BLOB)
字段。这允许将字节流存储到数据库中,就像任何其他字段一样。它不存储文件的类型以及文件系统可能维护的任何其他属性。从数据库读回时,您必须知道文件的类型。通常将其存储到同一个表中的其他文本字段中。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.例如,如果将其放置在文件系统中,则可以轻松删除或替换它。另一方面,在某些情况下,从数据库存储和检索它是不可接受的。
当然,还有很多事情需要思考。你没有明确问你最感兴趣的是什么。
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.
这是 Microsoft Research 发表的一篇文章,主题是在数据库中存储大型对象与在文件系统中存储大型对象。从 2006 年开始,但可以作为一个起点吗?
http://research.microsoft.com/apps/pubs/default。 aspx?id=64525
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