Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Location
    London England
    Posts
    8

    Unanswered: Getting an image BLOB in java

    can anybody tell me how to get an image out of mysql and into a java imageIcon or image object?

    I'm placing the image using:

    insert into table values(pKey, LOAD_FILE("c:/testPic.jpeg"));

    I'm obviously using JDBC and resultsets to connect!

    Any help would be super!

    Regards,

    sjl301

  2. #2
    Join Date
    Jul 2003
    Posts
    35
    Hi,

    This may or may not help...

    You can use PrepareStatement's getObject(x) and setObject(x,y) methods to store and retrieve the values.

    We use the Base64Encoder class (http://www.servlets.com/cos/index.html or similar) to encode and decode the objects (we store images, pdfs, worddocs, etc).

    Once you retrieve the decoded object as a byte[], you can pass it into something like ImageIcon.

    Chrs,
    Ash

  3. #3
    Join Date
    Feb 2004
    Posts
    1

    help to insert an image file

    hi
    I need to insert an image (gif file image[eg. client
    photograph]) to a
    long raw (not blob/bfile type) data type from PLSQL.
    [from sql plus and from
    a DB procedure/trigger] , Please send me the script
    for the same
    cheers
    priya

  4. #4
    Join Date
    Mar 2004
    Location
    Dubai
    Posts
    1

    Wink

    Have a look at :

    http://www.fawcette.com/javapro/2004...efault_pf.aspx

    Should answer most of your Q's.....


    H

Posting Permissions

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