I have a DB procedure which returns a BLOB. Can anyone tell me how to manipulate the BLOB? Is there any specific API for this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sure, the JDBC API.
You get hold of the
Blobinstance just as you get hold of any value from a result set. You should then use theget...– andset...methods on thisBlob.Here you basically have two options:
Work with a byte-array:
byte[]containing the data throughBlob.getBytesBlob.setBytes.Work with
InputStream/OutputStream:InputStreamthroughBlob.getBinaryStreamBlob.setBinaryStream.An alternative approach is to skip messing with
Blobin the first place, and instead use the second approach (with streams) directly through theResultSet-interface.