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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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

Problem in converting RAW data type to String

satya kiran
Ranch Hand

Joined: Nov 07, 2000
Posts: 52
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!
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30076

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