Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Is there a way to compress using Java deflator & uncompress using UTL ?

673660Jul 10 2009 — edited Jul 10 2009
hi,

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);
...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 7 2009
Added on Jul 10 2009
1 comment
1,141 views