Mapping java.io.InputStream to PL/SQL
From: Richard Krenek <rkrenek1_at_yahoo.com>
Date: 17 Jun 2002 13:50:49 -0700
Message-ID: <c8ac189c.0206171250.1b586f71_at_posting.google.com>
I have a java class that I am loading into Oracle using jpub. Now I need to create a PL/SQL wrapper around it. From what I have read I will not be able to do what I want but I am hopeful. Below is my java code. I have wrapped it without errors by using 'LONG RAW' but when I use the procedure it expects a byte[] which is not a stream. Oh and using BLOBs or BFILEs are not an option.
}
catch (Exception e) {
}
}
} Received on Mon Jun 17 2002 - 22:50:49 CEST
Date: 17 Jun 2002 13:50:49 -0700
Message-ID: <c8ac189c.0206171250.1b586f71_at_posting.google.com>
I have a java class that I am loading into Oracle using jpub. Now I need to create a PL/SQL wrapper around it. From what I have read I will not be able to do what I want but I am hopeful. Below is my java code. I have wrapped it without errors by using 'LONG RAW' but when I use the procedure it expects a byte[] which is not a stream. Oh and using BLOBs or BFILEs are not an option.
Thanks,
Rich
import java.io.*;
public class TestStream {
public static void writeFile(String name, InputStream in, String[]
msg) {
FileOutputStream out = null;
try
{
out = new FileOutputStream("/some_directory/"+name, true); byte[] buffer = new byte[32000]; int bytes_read = 0; while((bytes_read = in.read(buffer)) != -1) { out.write(buffer, 0, bytes_read); } out.flush(); out.close(); msg[0] = null;
}
catch (Exception e) {
msg[0] = "ERROR: "+e; try {out.close();} catch (Exception ignore) {}
}
}
} Received on Mon Jun 17 2002 - 22:50:49 CEST