This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How do I save a picture in database?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How do I save a picture in database??" Watch "How do I save a picture in database??" New topic
Author

How do I save a picture in database??

Nadia Marques
Greenhorn

Joined: Nov 17, 2005
Posts: 1
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

Joined: Jul 15, 2003
Posts: 1078
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

Joined: Aug 04, 2005
Posts: 88
You may check this tip:

How to store/retrieve image to/from SQLServer
http://www.java-tips.org/content/view/203/29/
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How do I save a picture in database??
 
Similar Threads
manage the picture file
Saving a picture of an applet
image uploading in order to save to database
Image location in the server?
save random numbers