Is there a way to compress using Java deflator & uncompress using UTL ?
673660Jul 10 2009 — edited Jul 10 2009hi,
I was wondering if there is a way to compress using Java deflator on the java side & then uncompress in the stored procedure. UTL_COMPRESS.LZ_UNCOMPRESS(BLOB) ?
I tried that, but I'm currently getting Invalid data exceptions..
The Other option is to use Java Inflator in the Java stored procedure. But I want to avoid java stored procedures.
Thanks in advance.
/// java side
String inputString = loadXML (inputfile);
byte[] input = inputString.getBytes("UTF-8");
byte[] output = new byte[inputString.length()];
Deflater compresser = new Deflater(Deflater.BEST_SPEED, true);
compresser.setInput(input);
OracleCallableStatement insertALLStatement = (OracleCallableStatement) con.prepareCall(insertALLSQL);
InputStream stream = new ByteArrayInputStream(data);
insertALLStatement.setBinaryStream(1, stream, (int)data.length);
insertALLStatement.execute();
// pl sql
create or replace PROCEDURE INSERTBYTES
( compressed IN BLOB
) AS
uncompressed:=UTL_COMPRESS.lz_uncompress (compressed);
...