Storing image in image column of SQL Server. Is it beneficial than storing image in folder on website - sql-server-2008

I have to display images on website and I can store image in the folder on my website and also I can store the image in image column of SQL Server.
So which way of storing image is better : in folder or in Image column of SQL Server.
1. Which way of storing image and retrieving it is faster

With SQL Server 2008, while you can store BLOB data, it's best to avoid it. I've done it in the past, grudgingly, and it did have negative performance implications. Unless you have some constraint which prevents it, use the file system. That's what it's built for, and it's much faster.

As #Martin Smith pointed out you could use FileStream. We started storing our files using FileStream so that we could also add full-text indexing and allow the users to not only search the data, but the files on our site. It is also nice because we can easily move our files along with teh Database to other environments (Dev, Test).
nice file stream Article: Here
Also, please use varbinary(max) if you are going to store in the DB. The image column is going to be deprecated in future versions.
--S

Related

Managing Large Databases of Images

I started working on a side project during the night. And it requires me to use large amounts of images, similar to Instagram, what do you recommend using as a database for this?
Should I upload the file to a path and referenced it from the database? Or should I use another type of database and upload the pictures there?
Thanks
"Should I upload the file to a path and referenced it from the database" - yes. Storing objects in mysql like that as a blob is bad practice. Put them in a directory somewhere and reference the path from your database of choice.. mysql is fine.
It won't be a good idea to store image directly in DB. DB size will increase. DB Hit will increase. So better store image as file in server and store the reference path in DB.
For Detailed Info :- Storing Images in DB - Yea or Nay?

Upload images on mysql

I am working on a social networking site and i would like some help. I want the users of the site to upload images on mysql database. (I am using jsp pages). Any ideas?
You can, although it's generally a bad idea.
It's better to store the images somewhere on your server and store the image's path in the database instead, where you can save it along with other data (e.g. information regarding the uploading user).
If you insist, store it using this type:
http://dev.mysql.com/doc/refman/5.0/en/blob.html
Here's an example.

From blob to filesystem. Which is the best location to store images?

I have read a lot of discussions about this topic and we all agree that, in most cases, the best solution is to save the images on the filesystem, and record the path in the database.
For this reason, we are redesigning our web application and enjoy all the advantages of this type of solution.
My question however is:
what is the best location where to save the images, especially to avoid problems of version control and deploying? The same way as the database, I think it's better that these files are not under version control, right?
For this I would like to get an advice on what is the best location where to save the file system:
Inside the Working Copy saying to version control to ignore them?
Outside the working copy?
In the folder where the database stores the data so you have "all the data together"?
are 3000 images of about 2mb
the control version is svn but soon will migrate to git
the db is MySQL with InnoDB tables with innodb_file_per_table

Storing text/image file in mysql database

Is it possible to store .doc/.txt or image files to stroe in database directly making attributes of type blob?I neewd a good working example for storing files inside database and also obviously retrieving them from database as original.
The blog entry http://mirificampress.com/permalink/saving_a_file_into_mysql describes the overall process in quite allot of detail for php.

whats best way to create documents Archive of images in the database's?

What is the best way to create an Archive of image documents in the database ?
Given we have about 2-10 million records and each record includes 2-4 images and about 20 text fields , what is the best way for create this archive so that we have good speed and high security for data?
Also, what database is good for this project?
Definitely use the file system as Minor suggested.
One option is SQL Server FILESTREAM. See http://msdn.microsoft.com/en-us/library/cc949109.aspx.
Use file system storage for archive image. You must save link in DB for the image file. And if you use a HTTP content you can use the cache proxy server such as Squid, Nginx, etc.
More questions for you:
How dynamic is the data? Do you store it once and never change it or it gets frequently changed?
Do you need versioning for the documents or the latest version overwrites the previous and that's it.
Are the documents always edited using one application or they can be changed outside (ex: using Word)
Are the documents related to other "non-document" data (database rows) or is it the only thing that you need to store?
File system won't offer any real security, so I would discount that straight off.
In Oracle there is built-in image support through the ORDImage type.
Check out Marcel's blog as he, and the Piction company, do a lot of work in this area and he has lots of useful material to download.
You can use control downloads. Look at http://kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/lang/en/