N
N
Narryel2019-10-02 14:44:59
Java
Narryel, 2019-10-02 14:44:59

How to cast a blob (>32k) to a string?

Hello!
Task: in the db2 database there is a table with a BLOB type column, it maintains data in JSON format, the size can exceed 32kb (varchar overflow), this data needs to be obtained. ORM - OpenJPA
tried casting to java.sql.Blob, pulling out an array of bytes from it, etc.,
everything I have is not working - the class of the object into which this blob is thrown (com.ibm.db2.jcc.am.he) .
thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlexHell, 2019-10-10
@AlexHell

no ORM - pure JDBC
https://www.ibm.com/support/knowledgecenter/ssw_ib...
byte[] outByteArray = blob1.getBytes(startingPoint, (int)endingPoint);
then specify in string with the desired encoding

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question