File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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 and Relational Databases
Bookmark "Convert String to Blob" Watch "Convert String to Blob" New topic

Convert String to Blob

Kathy Navarro

Joined: Oct 04, 2004
Posts: 8

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?

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33113

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

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Convert String to Blob
jQuery in Action, 3rd edition