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 Convert String to Blob Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Convert String to Blob" Watch "Convert String to Blob" New topic
Author

Convert String to Blob

Kathy Navarro
Greenhorn

Joined: Oct 04, 2004
Posts: 8
Hello,

I am trying to write to a database a Blob value from a String. I use the getParameter method to retrieve the string from the JSP pages, but then the database expects it as a blob. Is there any way to make to conversion from String to Blob or should this be done on the part of the SQLServer?

Thanks!
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31062
    
232

Kathy,
You can use the statement.setBinaryStream() method to convert your String to a Blob.


[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: Convert String to Blob