This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Retrieving LONGVARCAR data type from SQL Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Retrieving LONGVARCAR data type from SQL Server" Watch "Retrieving LONGVARCAR data type from SQL Server" New topic
Author

Retrieving LONGVARCAR data type from SQL Server

martin rolph
Greenhorn

Joined: Apr 16, 2002
Posts: 9
Hello,
I've got a recordset from a Query in a SQL Server db. What I'm trying to do is just print out the columns. All is fine when the data types are CHAR or INT but things go wrong when it is LONGVARCHAR (text field in MS SQL). When I try to print out the result I just get the text value as hexadecimal code. I've tried to use:
recordSet.getString("field") and recordSet.getAsciiStream("field") and recordSetCharacterStream("field") but all return the text as hexadecimal.
I've tried lots of difference readers, such as


Does anyone know how I can convert the Hex to ASCII?
martin rolph
Greenhorn

Joined: Apr 16, 2002
Posts: 9
I finally found the answer. I had to do this

but I don't know why this works!
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Retrieving LONGVARCAR data type from SQL Server
 
jQuery in Action, 3rd edition