File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion 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
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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31054
    
232

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in converting RAW data type to String