Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to store jpg/gif picture in Database

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want Know whether it is possible to store gif's or picture in Database? if yes! how and which DataBase to store? How about Oracle?
 
jahanns
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far I know Oracle has very good feature to store gif/jpg images in database.
Infact we need to declare datatype as longvar(I am sure about the exact data type name refere Oracle jdbc doc) which store the data in binary form up some GIGA BYTES.
Basically you will read the gif/jpg file data and put it into longvar.
when ever you want to retrieve the data same read as binary and save as file with specific extention (gif/jpg).
Oracle 7.3 has very good documentation on JDBC where you can also find above information in detail.
Jahanns
jahanns@computer.org
http://jahanns.virtualave.net/
 
hanumanth reddy
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes u can insert jpg/gif in the oracle database

go through the oracle documentation for the example to insert and retrieve the gif/jpg
the datatype used to store is longraw or raw
 
sean zang
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI, all
Does anyone know how to handle gif/jpg in Mysql database?
I mean how to save and retrive gif/jpg in the client(broser) through jsp or servlet
thanks in advnace
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the database supports blobs, you can save the gif/jpg that way.
 
sean zang
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,Thomas Paul
Could you please show me a simple code?
many thanks
 
Amit Zzz Kulkarni
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Blob is Binary Large Object basically you are simply using I/O Streams,go through the database documentation.
 
Amit Zzz Kulkarni
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi mohan raj,
I am posting my response to your question here so others can benefit.
http://oradoc.photo.net/ora81/DOC/java.815/a64685/oraext4.htm#1003223
>>>i found ur posted message in javaranch. there u have mentioned to use blob to storage large objects in oracle. i have used BFILE to store an gif file in oracle database. but i need to use BLOB to store that image. but the difficulty is i don't know how to store the file there ...can u show some sites or examples to do so..
Amit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic