This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JDBC and the fly likes Images stored in the database Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Images stored in the database" Watch "Images stored in the database" New topic
Author

Images stored in the database

Alex Khvatov
Ranch Hand

Joined: Nov 07, 2005
Posts: 36
Could someone tell me which is the better approach having the database store images as BLOBs or store a path to images and have a class that would sort of 'cascade' the image deletion if the row containing a path to the image is deleted from the database?

I'm just conserned with the database performance since storing images can easily make datafiles huge.

Is there an alternative approach?
I would like to know your oppinion.
Thanks.
Alex


SCJP 5<br />SCWCD 5
Alex Khvatov
Ranch Hand

Joined: Nov 07, 2005
Posts: 36
'opinions' of course :roll:
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26496
    
  78

Alex,
If the images are very static, it is fine to point to them. If they change, it is better to store them in a BLOB. Since you mentioned wanting to delete an image when nobody is pointing to it, I think you would be better served by storing them in the database. Then the database can handle the integrity of image mangagement.

Databases are getting better at storing BLOBs. And databases are meant to store large amounts of data. From a bytes point of view, those images are still going to be stored somewhere.

Also see another thread that discusses this.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Sabarish Sasidharan
Ranch Hand

Joined: Aug 29, 2002
Posts: 73
How many images are we talking about? if it is going to be a few, like say 500-2000 it might just be easier storing as blobs. But if it is more than that, better to store in filesystem.

Check with ur DBA. Iam sure your DBA would not prefer storing it in the database.


Sab<br /> <br />Perfection does not come from belief or faith. Talk does not count for anything. Parrots can do that. Perfection comes through selfless work.<br />Swami Vivekananda
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Images stored in the database
 
Similar Threads
What is best way to name jpg images in a web application?
Storing images into database using jsp
Storing image: Is it good to keep in DB or disk
how to display image using servlets..?
display image after retrieving it from database?