aspose file tools*
The moose likes JDBC and the fly likes Storing image: Is it good to keep in DB or disk Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Storing image: Is it good to keep in DB or disk" Watch "Storing image: Is it good to keep in DB or disk" New topic
Author

Storing image: Is it good to keep in DB or disk

Rayudu addagarla
Ranch Hand

Joined: Aug 17, 2000
Posts: 39
Hello
I would like to know which approach is better and in performance wise which is good.
I want to store images and pull to show in webpages.
1. Is it good to keep the actual image on disk and keep link in database.
2. or store the image itself in database. eg: using MySQL BLOB.
Which would be faster to retrieve on webPage.
What is the common practice in the industry.

Environment: Linux,java or php MySQL , Apache or Tomcat

thanks


Good luck for Certfication.
Joe Nguyen
Ranch Hand

Joined: Apr 20, 2001
Posts: 161
Although retrieving image from disk is faster and not depending on availability of db connection, I would prefer the second option and cache the most used images.
Manuel Sanchez Iba�ez
Greenhorn

Joined: Jul 12, 2005
Posts: 20
too i�m interesting in this issue. What size is greater? saving in a folder/File or saving in Blob field?

The option more good is other issue. I�m interesting in the size

�Anyone can help me?
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
I prefer the disk option myself. The less BLOBs you can store in your database the happier (and faster) things will be.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

However if your database is on a server being accessed from more than one computer, the alternative to a blob is to store the images on a file on the database server. (Storing copies of the images on every computer that's accessing the database is obviously impractical.) Then you have the problem of how do those computers access the file system on that server, which may or may not be easy to solve.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Storing image: Is it good to keep in DB or disk