• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Blob/Clob or Files

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are the advantages of Blob/clobs over files, assuming that the files are non-corruptible and safe?

Instead of storing data as blobs, why shouldn't i just store them as files on hdd and store the path in db?
Please advise.

Also, when should one be opted over another?
I need to store movie files of the order of max 50mbs. What should i use?

Please advise.
Also, whats the difference between blob and clob, other than one being binary? A difference in layman's terms.

Thanks a lot in advance.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Storing data on the file system and in the database weekens the data model. You can't impose a not null constraint for the file for example. Also the file system is not a transactional resource. If you create a record in the database pointing to a file and the file save stage fails you'll have to handle the rollback manually. Another thing is the file system is a difficult resource to access from a distributed environment - at the bare minimum you are probably going to have to introduce some OS specific access stuff (i.e. different UNC syntax) plus some admin overhead to maintina a share or how ever you implement this.


Also, whats the difference between blob and clob, other than one being binary? A difference in layman's terms.


A blob == Binary large object, i.e. any binary data. Clob == Character large object i.e. specifically character data.
[ May 09, 2007: Message edited by: Paul Sturrock ]
 
fahad siddiqui
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, does it imply that there are no performance advantages of blob over file systems?
In most of the projects, i have seen files being stored on hdd and paths being held in db. Does this have anything to do with number of files or size of files?

Thanks for the transactional implications of a file system storage.
 
fahad siddiqui
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at this link:
http://databases.aspfaq.com/database/should-i-store-images-in-the-database-or-the-filesystem.html

What would you advise me to use for storing video files which will be streamed onto the webpage when clicked? This would be strictly a single video being played when clicked on its image.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


So, does it imply that there are no performance advantages of blob over file systems?


There will probably be a performance difference. But these differences (as with most performance issues) will be very much specific to your environment. I would guess that there is a bigger overhead streaming the file into the database before the database persists it to the file system simply because using the file system direct misses the DB step. Performance is a smaller concern than some of the other issues I highlighted though.
reply
    Bookmark Topic Watch Topic
  • New Topic