Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using RDBMS to store images

Status
Not open for further replies.

JProg

Programmer
Apr 4, 2002
88
JP
Hey Everyone,

I fear that I am turning into a serious geek! Ah well, that is a fear we all have to live with right. Anyhow I have been reading a little lately about storing image files in databases. Particularly I have managed to find information on storing images in DB2 and MySQL using Java. I like Java, ah well it is the only language I am half decent with (aside from English), so for now it will do in place of a woman (scary!). Of the articles that I have read there is information on storing the pictures, usually as BLOBs (Binary Large Objects) and information on how to retrieve the pictures using JDBC (Java Database Connectivity). This is all very well, and to my thinking the code isn't the simplest on Earth!!! I guess the thing that has been eating at me is "What is the value of storing pictures in a database?". Before I make a decision on whether to explore this side of the various technologies I am seeking other peoples opinions.

What do you think of storing pictures in a database? Please leave your pros and cons and preferably any experience you may have with doing this.

Thanks heaps for your time and patience (in reading through my over sized post). Take it easy.

Regards

Davo
 
well

generaly it is slower then the file system

in the db you can make a better privelege system and access to the files (on a file system it is much harder to do that kind of control)
being in the db backups and transfers of db is relativly more easy since you just make a db backup/transfer

there are sure other pros and cons, but now I can't think of any
personaly I've used both methods for different kind of things
 
ceco,

Thanks for the reply. Could you please give me an example of where you have used this?

Thanks heaps for your help.

Regards

Davo
 
probably the most specific case is for something like crm/pm system which includes document exchanges etc. I put everything in the db because: it is not heavy loaded proces; when installing on clean system you do not have to set permissions of directories etc (thus easier installation and actually easer control of the access of the files); when backuping - backup only the DB, these are the basic things

I am not sure if I typed it clear ;-))
 
What are your aims for the solution?

I believe Postgres Blobs can hold pictures and then you should have very versatile control over what is shown to whom but I think you introduce a fair overhead to your system.

Postgres might be able to store relative filenames and conceal directory paths and complications from the user. This would be the middle ground and still allow you quite a bit of control but the database would not have to store the actual pictures. The disadvantage of this is less control and possiblities of dead links.

Lastly, if you can structure the way you want to view the pictures you may be able to get away with some sort of directory based html structure. I think this would give you the smallest overhead and I imagine you could find a package that would do most everything you want. There is probably a PHP solution that would fit your needs.

It sort of depends on what your goals are and how much data you need to shuffle around.
 
I'm of the never store large files in the database camp myself. I think it's just a waste of processing power & space.

Put the files on the filesystem, use the database to point to them. If we're talking about a *nix system there should be no issue of control, you can go ahead and lock down the files as you please.

As far as dead links are concerned, a trivial script should be able to clean those up in nothing flat.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top