wood burning stoves 2.0*
The moose likes JDBC and the fly likes Problem in converting RAW data type to String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem in converting RAW data type to String" Watch "Problem in converting RAW data type to String" New topic
Author

Problem in converting RAW data type to String

satya kiran
Ranch Hand

Joined: Nov 07, 2000
Posts: 52
Hi,
I retrieved an Oracle RAW data type by
byte b[]= statement.getBytes(n).
Somehow, I need to have the String represtation of this field, and later also need to convert back to the byte[].
When I use new String(b), it just gives me some unreadable symbols.
While at the same time, I know this field have a value like: D1EE971C4852A356E03311227403A356.
I tried using
Byte[] message = rs.getBytes("MessageID");
String str = new String (message); (I also tried using new String(message, "UTF-8"))
Thanks in advance for the help!
Regards,
Satya
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

Satya,
Where did the raw data come from originally. Often this problem occurs when there is binary (non-character) data in the bytes.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Problem in converting RAW data type to String
 
Similar Threads
Convert image to raw binary data
java mail API uses streaming
How to convert RAW(32) to String?
B&S:db format question
Reading the schema