Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image insertion

 
akilan kandaswamy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai all,
pls some1 tell me how to insert a image into a database and retreving it from the database, Code will be helpful.
thanx
 
hanumanth reddy
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Read the Image Using Input stream and store that Store in the data base and retrive back and make it a file

 
David Freels
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will need to use a PreparedStatement and set the image to a stream. The database will store the image in a BLOB.
Here is a chapter from the tutorial with code examples:
http://java.sun.com/j2se/1.3/docs/guide/jdbc/blob.html
Hope this helps.
David
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic