You are here: Re: Storing pictures in database « MsSQL Server « IT news, forums, messages
Re: Storing pictures in database

Posted by Erland Sommarskog on 09/15/07 21:28

Zeljko Bilandzija (zac9393@email.t-com.hr) writes:
> Thanks to both of you on help
>
> but i give you example what i'm interesing
>
> i want to put some pictures on server or local disk, and i want make, for
> example, column named "Pictures", and store in that column url or path on
> local disk, to get that pictures when i refer to particular id in query on
> web page. If I can do that in this way, which type of data to choose for
> that column (how make that links or paths)

If you store a URL, then your application will have to connect to a web
service or somesuch to get the picture. Whatever, it's beyond the scope
for this newsgroup. The data type would simply be varchar(500) or what
upper length you want to place on the URL.

If you store the picture on disk, the application must be able to
access the disk the file is on, and normally the client in an client-
server setup does not have access to the disk on the server, only the
server application, in this case SQL Server. And SQL Server is not going
to read the files from disk for you.

Overall, I disagree with Greg's recommendation to store the pictures in
the file system. In SQL 2000 and before, this solution had some attraction
that the data types for large objects (text, next and image) were difficult
to work with. But SQL 2005 introduced replacement for these that are
very simple to work with. And in about all other parts, storing the
images as files in the file system means more work. As I've mentioned,
you need to ensure that clients can access the files. Backups are more
tricky, because you need to backup database + directory. There is also
bigger risks for corruption in the sense that a file could be deleted
from disk, while there is still a path to it in the database.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация