?
Solved

Java PL/SQL BLOB

Posted on 2005-04-08
4
Medium Priority
?
274 Views
Last Modified: 2010-03-31
how can i return a blob from stored procedure and how to parse the returned blob from stored procedure in java.
0
Comment
Question by:venkatkodali
  • 3
4 Comments
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13737795
What does the blob represent, an image?

ResultSet rs = s.executeQuery("SELECT image FROM myImageTable");
if (rs.next())
{
    Blob blob = rs.getBlob("image ");
    long n = blob.length();
    byte[] bytes = blob.getBytes(1, n);
    Image i = Toolkit.getDefaultToolkit().createImage(bytes);
}
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13737853
Although you will need to use a callable statement for the stored proc:

CallableStatement stmt =  con.prepareCall( "{call spu_get_image()}");
ResultSet rs = stmt.executeQuery();
0
 

Author Comment

by:venkatkodali
ID: 13740211
how to get a blob from stored procedure
0
 
LVL 29

Accepted Solution

by:
bloodredsun earned 1500 total points
ID: 13741293
>>how to get a blob from stored procedure

Sorry but what do you mean. You write a stored procedure that performs a select statement that returns a resultset. In the resultset is a blob which you then use as in my first example.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month16 days, 8 hours left to enroll

864 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