wood burning stoves
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: 3749

Refer to the Blob API http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Blob.html

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]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: How to Display the BLOB Field
jQuery in Action, 3rd edition