• 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

storing images in database

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how do we store gif images in sql server and how do we retrieve them?
is it useful to store images in the sql server.
thanks
 
author & internet detective
Posts: 41919
910
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jyotsana,
You can store images as a BLOB. You would get/set them using JDBC. There are methods for byte[], binary stream and blob.
There are some reasons for storing images in a database. But, if they are images that are part of a web page, you are often better off storing them on a web server.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is it useful to store images in the sql server.
My 2 cents. It depends. If your application is image intensive meaning your application that depends on the Database is primarily an imaging storage/retreival app of some sort which would mean that the majority of the data in your database is going to be binary data, then sure. There are also ways to optimize performance on some DB's for image storage/retreival.
On the other hand, if you application is primarily data centric and just stores a few images here and there (I would say 60% data, 40% images or less) then storing images along side data in a Database can really hurt your performance. In this situation it would be best to store the images somewhere on the harddrive and simply store reference/location data in the database of where the image is located on disk.
Do you like how that really didn't answer your question?
As far as "how to.." I found this on Google. It should get you started.
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My two cents...with interest:
The two cents:
I have never been a fan of storing images in a database. Images can really hamper db performance and increase db size tremendously. IMHO, just store the location and filename in the image field like Gregg said and then use that to pull image from file location in your web project or app.

The interest:
Opinions are going to vary on this subject. Some will argue that it is better to store all record data in a centralized location. Others, like me, say that storing a reference to the image is worth the extra effort if it will improve performance. Most users do not know where data is stored, and for the most part don't care, as long as the data is accessible.

Good luck in your decision and I too probably did not help you. :roll:
 
reply
    Bookmark Topic Watch Topic
  • New Topic