how to convert bytes[] to blob

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rokenbok
    New Member
    • Mar 2008
    • 1

    how to convert bytes[] to blob

    hi,
    I have a password field that I need to store in a db2 database. I created a blob field in my table, and I am trying to update it with the following java

    dal.getPrepared ().setBytes(15, pwBytes);

    The code executes without errors, but when I look at the field, it has this in in

    COM.ibm.db2.jdb c.app.DB2BLob@3 a3d1183

    I am trying to figure out how to convert a bytes[] field into a blob, but I am coming up dry.

    So I have 2 questions:
    1. Is Blob the correct field type to story bytes[] data?
    2. What java type should be used to pass bytes[] data to db2?

    Thanks for your help
  • sakumar9
    Recognized Expert New Member
    • Jan 2008
    • 127

    #2
    Originally posted by rokenbok
    hi,
    I have a password field that I need to store in a db2 database. I created a blob field in my table, and I am trying to update it with the following java

    dal.getPrepared ().setBytes(15, pwBytes);

    The code executes without errors, but when I look at the field, it has this in in

    COM.ibm.db2.jdb c.app.DB2BLob@3 a3d1183

    I am trying to figure out how to convert a bytes[] field into a blob, but I am coming up dry.

    So I have 2 questions:
    1. Is Blob the correct field type to story bytes[] data?
    2. What java type should be used to pass bytes[] data to db2?

    Thanks for your help

    1. Blob is the correct field to store bytes[] data.
    2. Use Blob type to pass bytes data to db2.

    Check this sample: sqllib/samples/java/jdbc/dtlob.java

    Regards
    -- Sanjay

    Comment

    Working...