将文件保存到数据库 [英] Save files into a database

查看:173
本文介绍了将文件保存到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将文件保存到我的C#Windows应用程序的数据库。我应该/我可以使用什么数据库技术?



我想要能够用我的应用程序保存文件和打开保存的文件。



> 指向BLOB或不指向BLOB



他们的结论基本上是:




  • 如果您的文件大小不超过256 KB, 内部数据库

  • 如果文件大小为1 MB或更大,请将其存储在文件系统中, FILESTREAM 功能在SQL Server 2008中)

  • 如果您的文件大多在这两种尺寸之间,则归结为其他因素,如更新频率,可用的硬件等。



如果您需要存储大于2 GB的文件,文件系统是你唯一的选择,真的。因此,这也可能是一个决定性因素。


I want to save files into a database in my C# Windows application. What database technology should/could I use?

I want to be able to save files and open saved files with my application.

解决方案

If you're dealing with Microsoft SQL Server, there's a really interesting performance comparison done by Microsoft Research:

To BLOB or not to BLOB

Their conclusion basically is:

  • if your files are mostly 256 KB in size or less, store them inside the database
  • if your files are mostly 1 MB or larger, store them in the file system and only store a reference to them in the database (e.g. using the FILESTREAM feature in SQL Server 2008)
  • if your files are mostly between those two sizes, it comes down to other factors, like frequency of update, hardware available and so forth

And if you should ever need to store a file larger than 2 GB, storing it in the filesystem is your only choice, really. So that might also be a deciding factor.

这篇关于将文件保存到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆