[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

read the  blob data from database and put it into string variable

Posted on 2011-05-03
7
Medium Priority
?
365 Views
Last Modified: 2012-05-11
i want to read the blob data from database and put it into string variable

could you please give me the pseudo code for that.
0
Comment
7 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 2000 total points
ID: 35630533
This shows how to raed blob into image

http://www.java2s.com/Code/Java/Database-SQL-JDBC/ReadBLOBsdatafromdatabase.htm

Usually blobs do not contains strings
Strings are stored in clobs

0
 
LVL 26

Expert Comment

by:ksivananth
ID: 35631648
if its string, why don't you use clob?

here is an example to read clob to string http://maclochlainn.wordpress.com/how-to-read-a-clob-through-jdbc/
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

Expert Comment

by:for_yan
ID: 35633331
If the string is in clob then at least in Oracle
you can even select String directly:

select to_char(clob_column) from table_with_clob

The to_char(clob_column) will be varchar2 which can further be treated as a string in Java code
0
 
LVL 92

Expert Comment

by:objects
ID: 35633837
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 35687696
See http://technojeeves.com/joomla/index.php/free/51-copying-streams (obviously making sure that the field CAN be held in a String [encodes in a valid way]):
String s = IOUtils.inputStreamToString(blob.getBinaryStream());

Open in new window

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month19 days, 9 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question