aspose file tools
The moose likes JDBC and Relational Databases and the fly likes Is there other way to getBlob 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 "Is there other way to getBlob" Watch "Is there other way to getBlob" New topic
Author

Is there other way to getBlob

David Wong
Greenhorn

Joined: Dec 31, 2007
Posts: 15
I want to assign a string value to a Blob object.

Obviously there are many methods of Class can do this under java.sql package,but now the rule is changed, if there is a way out to get done this without the JDBC the ResultSet.getBlob(). If I use a hibernate and Struts,I get a string from view layer and have this value stored into the Transient object.

Thanks in advance!


Bitter Java For Better Life.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31656
    
189

David,
Blobs are binary data whereas Strings are character data. A Clob maps to a String. Or a Blob can map to an array of bytes. Can you clarify a bit?


[OCA 8 book] [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
David Wong
Greenhorn

Joined: Dec 31, 2007
Posts: 15
Originally posted by Jeanne Boyarsky:
David,
Blobs are binary data whereas Strings are character data. A Clob maps to a String. Or a Blob can map to an array of bytes. Can you clarify a bit?


Thanks for so helpful information.But I have a field in Blob type in my database. It is like a web blog, I want this Blob field can store the text and photos as well. In fact I wanna all things from the client submited. I think since the Blob are binary data, so it can handle any type of data, besides string. and I confused by how converting this.

Consider this, I wrote a blog today, the content of this article is rich enough, it contains photos and words and other ASC codes like a carriage return symbol("\n"). I have all of this blog putted into the Blob field. That is what I am thinking about.

All information in a computer represented by binary data, so, string can trasform bytes data, but I search the API about Clob/Blob, they are interfaces and can be instantiated only by invoking JDBC methods, like ResultSet.getBlob()/getClob();

To sum up, I do not know how to make a Blob type take the client data.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is there other way to getBlob