By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,137 Members | 2,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,137 IT Pros & Developers. It's quick & easy.

Storing Documents and Images - In the database or as a link?

P: n/a
Hi There,

Being quite new to MS-SQL I would like to ask if there is a general opinion
of what approach should be taken to storing things like external documents
and images in databases.

Should the actual files be stored within the database, or instead should
links to the files on a file server or something similar be stored instead.

For the end user I imagine it is easier to have everything stored within the
database, because doing it the other way in effect gives another level of
management because there is the need to perhaps manually look after the file
server with all the image files or document files on.

In my particular case, I am building a database where the users use a great
many Word documents. For example, I particular record might have a number of
different Word documents associated with it.

I was going to create a "Documents" table that all documents were stored in
(including meta data about each document because it will be really useful to
be able to search for documents so that they can be reused).

In this table I was in a dilemma as to whether to actually store the
documents in the table. Other then the performance hit and memory
requirements this will require, are there any other disadvantages?

What are the general thoughts when a database needs to manage a lot of pdf
and word documents?

Thanks in advance.

Dave.
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
nib
inline...

Dave Smithz wrote:
Hi There,

Being quite new to MS-SQL I would like to ask if there is a general opinion
of what approach should be taken to storing things like external documents
and images in databases.
Depends on what your situation warrants.

Should the actual files be stored within the database, or instead should
links to the files on a file server or something similar be stored instead.
Either works. Both have pros and cons.

For the end user I imagine it is easier to have everything stored within the
database, because doing it the other way in effect gives another level of
management because there is the need to perhaps manually look after the file
server with all the image files or document files on.
You can automate the storage/retrieval of the documents even if they're
stored in a directory instead of the database.

In my particular case, I am building a database where the users use a great
many Word documents. For example, I particular record might have a number of
different Word documents associated with it.

I was going to create a "Documents" table that all documents were stored in
(including meta data about each document because it will be really useful to
be able to search for documents so that they can be reused).

In this table I was in a dilemma as to whether to actually store the
documents in the table. Other then the performance hit and memory
requirements this will require, are there any other disadvantages?


Personally, I lean towards using the database for storage. A quick list
of why:

1) Store multiple documents for the same entity without having to create
naming standards
2) Security
3) only allows editing via your applications

cons:

1) requires additional programming on your end due to dealing with blobs
2) takes more db space (but, you'll be taking up the space anyway)

Zach
Jul 20 '05 #2

P: n/a
Dave Smithz (SPAM FREE WORLD) writes:
Being quite new to MS-SQL I would like to ask if there is a general
opinion of what approach should be taken to storing things like external
documents and images in databases.

Should the actual files be stored within the database, or instead should
links to the files on a file server or something similar be stored
instead.


Many people advocate storing files on disk and only store the links in
the database. Undoubtedly, this solution is a lot simpler to implement,
since to store the documents in the database you need to use the image
datatype which is not very simple to work with.

But if you store files on disk, you don't have the consistency check that
transactions buys you. You may store a link in the database, but the
file is for some reason not stored on disk or vice versa. And if someone
uses the Explorer to search the directory, he might delete files by
accident or malice. Of course a malign intruder may delete data in your
database, but you are probably safer to accidents.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3

P: n/a
If you store them in the database you know for sure where each one is.
If you store the path, people can move the files and then your
database is kinda useless.

On Mon, 25 Oct 2004 20:49:31 +0100, "Dave Smithz" <SPAM FREE WORLD>
wrote:
Hi There,

Being quite new to MS-SQL I would like to ask if there is a general opinion
of what approach should be taken to storing things like external documents
and images in databases.

Should the actual files be stored within the database, or instead should
links to the files on a file server or something similar be stored instead.

For the end user I imagine it is easier to have everything stored within the
database, because doing it the other way in effect gives another level of
management because there is the need to perhaps manually look after the file
server with all the image files or document files on.

In my particular case, I am building a database where the users use a great
many Word documents. For example, I particular record might have a number of
different Word documents associated with it.

I was going to create a "Documents" table that all documents were stored in
(including meta data about each document because it will be really useful to
be able to search for documents so that they can be reused).

In this table I was in a dilemma as to whether to actually store the
documents in the table. Other then the performance hit and memory
requirements this will require, are there any other disadvantages?

What are the general thoughts when a database needs to manage a lot of pdf
and word documents?

Thanks in advance.

Dave.


Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.