Posted on 2005-04-08
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.
Question by:venkatkodali
    LVL 29

    Expert Comment

    What does the blob represent, an image?

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

    Expert Comment

    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();

    Author Comment

    how to get a blob from stored procedure
    LVL 29

    Accepted Solution

    >>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.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    squareUp  challenge 22 81
    hash value 2 29
    advance java 4 36
    firstChar challenge 13 57
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    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…
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now