tags:

views:

34

answers:

1

JavaBean has some field type of byte[].

Bean is stored in DB to BLOB type of column.

I know that it is XML message.

How can I see this XML message.

thank you very much for your help!

+1  A: 

Convert those bytes to characters. You only need to know the character encoding beforehand, otherwise those characters will end up like mojibake.

Here's an example using String constructor and UTF-8 character encoding:

String string = new String(bytes, "UTF-8");
BalusC
+1 - got me by 34 seconds ;)
SB
Thank you very much for so fast response :)
moa
In order to read this xml from DB can I do this:
moa
REsultSet rs...Blob blob = rs.getBlob();...bytes[] bytes = blob.getBytes;String string = new String(bytes, "UTF-8");
moa
Behind each comment, there's an `edit` link (and a `delete` button). Please make use of it instead of spamming with a lot of comments in short time :) As to your question: what exactly is the problem when you do that? Or haven't you tried it at all? Do it first.
BalusC