Results 1 to 4 of 4
  1. #1
    sandeep23k is offline Member
    Join Date
    Aug 2010
    Posts
    5
    Rep Power
    0

    Default How to save image in database

    Hi All

    i receive the image data form server as hex format and i want to save these data as image in the Mysql how it is possible .pls advice

    thanks
    sandeep

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,090
    Rep Power
    20

    Default

    Presumably it's an input stream you get, so feed that stream into the setBinaryStream() method of a PreparedStatement, for the correct column. This of course assumes that you aready have a table with the correct column in it.

  3. #3
    arun9683 is offline Member
    Join Date
    Jun 2010
    Location
    Bangalore,India
    Posts
    70
    Rep Power
    0

    Default

    You should have column data type as blob in the database.

    Then use the following code to set as binary stream

    pstmt.setBinaryStream(1, istream, (int) (fImage.length()));
    Arun K R,Bangalore,India
    :)

  4. #4
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,090
    Rep Power
    20

Similar Threads

  1. Save JTable to database
    By Geraldo in forum AWT / Swing
    Replies: 0
    Last Post: 06-04-2010, 02:03 PM
  2. how to save image as jpg?
    By katie in forum New To Java
    Replies: 4
    Last Post: 04-15-2010, 10:07 AM
  3. how can i save an image from url
    By happyday in forum Advanced Java
    Replies: 2
    Last Post: 01-14-2009, 07:02 PM
  4. Save a jpg image on server
    By yadavjpr in forum Java Servlet
    Replies: 1
    Last Post: 11-21-2008, 01:49 PM
  5. save file to database
    By katerinaaa in forum New To Java
    Replies: 0
    Last Post: 08-14-2007, 12:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •