Results 1 to 8 of 8
  1. #1
    Join Date
    May 2008
    Posts
    4

    Unanswered: how do we retrieve BLOB from DB2 through JDBC

    Hi,
    I had one XML, Converted that into bytestream and stored as a BLOB in DB2.
    Could you Please suggest how do we retrieve BLOB from DB2 through JDBC?
    Please share the code if you know.

    Thanks,
    Kiran

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    BLOBs are not different from any other value like integers. You just select from the column and retrieve the value into a byte array or some other suitable host variable.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  3. #3
    Join Date
    Apr 2008
    Posts
    39
    Hi,

    You can refer to SQLLIB/samples/xml/java/jdbc/XmlRead.java.
    This sample shows you how to retrieve the BLOB data in DB2 through JDBC.

    Thanks,
    Madhavi

  4. #4
    Join Date
    May 2008
    Posts
    4
    Hi Madhavi,
    Could you please send us the complete link.
    And one more thing, We are trying retreving the BLOB using getBlob() method.
    But we are getting Null but there is no Exception and error too.

    Thanks,
    Kiran

  5. #5
    Join Date
    May 2008
    Posts
    4

    Retreving BLOB from DB2 using JDBC

    Hi Madhavi,
    Could you please send us the complete link.
    And one more thing, We are trying to retreve the BLOB using getBlob() method.
    But we are getting Null and there is no Exception and error too.

    Thanks,
    Kiran

  6. #6
    Join Date
    Apr 2008
    Posts
    39
    Hi Kiran,

    If you have access to DB2 machine, there is a sample which shows how to read BLOB data in DB2 through JDBC.

    The sample is available in $HOME/sqllib/samples/xml/java/jdbc/XmlRead.java.
    Note: This sample works with sample database tables.

    Thanks,
    Madhavi

  7. #7
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Are you sure that there is a BLOB value in the column? Maybe you get NULL because the value is NULL?
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  8. #8
    Join Date
    May 2008
    Posts
    4
    Thanks for your response guys,

    Data is there inside the database.

    Thanks,
    Kiran

Posting Permissions

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