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

How do I save a picture in database??

 
Nadia Marques
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Helo!! I have a picture in the JPanel and I need to save it in a database. How can I do this?
Nadia
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This probably belongs in JDBC forums.

You should be able to open a Connection and open a binary stream you can write to using a PreparedStatement. In our database we store images as blobs and upload them with this methodology. Unfortunately the source isn't something I can post here, but that should give you an idea of where to look.
 
Casper Maxwell
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may check this tip:

How to store/retrieve image to/from SQLServer
http://www.java-tips.org/content/view/203/29/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic