Link to home
Start Free TrialLog in
Avatar of venkatkodali
venkatkodali

asked on

Java PL/SQL BLOB

how can i return a blob from stored procedure and how to parse the returned blob from stored procedure in java.
Avatar of bloodredsun
bloodredsun
Flag of Australia image

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);
}
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();
Avatar of venkatkodali
venkatkodali

ASKER

how to get a blob from stored procedure
ASKER CERTIFIED SOLUTION
Avatar of bloodredsun
bloodredsun
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial