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 How to Display the BLOB Field 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 "How to Display the BLOB Field " Watch "How to Display the BLOB Field " New topic

How to Display the BLOB Field

gurusamy sengodan
Ranch Hand

Joined: Oct 13, 2005
Posts: 41
I have written the code to get the BLOB Fields from the table.
That BLOB Fields contain XML.
How to view the content of that BLOB Field i mean that XML.
I want to see the content of That XML.
The code snippet:-
Blob aBlob = resultSet.getBlob(1);

Now the aBlob contains the XML. How to display the content of aBlob.
I want to see the content through the code.

Thanks in Advance
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3740

Refer to the Blob API

You can read the Blob as an InputStream and then for the most part treat it as you would read a file. You can pass the InputStream to a XML constructor and load it as an XML object.

[OCA 8 Book] [Blog]
I agree. Here's the link:
subject: How to Display the BLOB Field
It's not a secret anymore!