Zip using Oracle stored procedure

I am currently using the Oracle UTL_COMPRESS.LZ_COMPRESS() to compress some data. But the problem is that it compresses the thing using the GZIP format, which, unfortunately, is also not compatible with ZIP. Therefore, Windows XP's own decompression program cannot open it (you know that the thingie compressed folder). And the user must use another utility, for example 7Zip , Winzip or Filzip , etc., to unpack it.

So, we have a plan to extract GZIP data from Oracle, unzip it using Java and compress it back to ZIP (something that can be unzipped by Windows). This sounds funny for compress-in-gzip -> decompress -> compress-again-in-zip .

Any idea how we can compress it in the desired format in the first place in order to avoid all the extra calculations?

+7
oracle plsql stored-procedures zip utility
source share
3 answers

There is a Java package java.util.zip that supports the WinZip format. And in Oracle, we can create Java stored procedures that represent Java classes in a form that can be called using native PL / SQL programs. Find out more .

So, you need to write a file containing the data in an uncompressed state, and then submit it through the JSP to pin it. If you do not want to write your own implementation, then look at this article by Vadim Loevsky . It includes a Java stored procedure for OS zip files.


Note. In this context, JSP stands for Java stored procedure, which is a Java program embedded in a database. This is not the same as Java server pages, which are web technology, and therefore the more common use of the acronym JSP. I apologize for any confusion.

+8
source share

UTL_RAW.CAST_TO_RAW is not any compression algorithm. I don’t know where you came to the idea that this is so. RAW (and its big cousin BLOB) simply stores data that is not a number, date, or string. You do not want to store binary data in strings, because there is a chance of problems with character conversion.

The correct PL / SQL package for compression is UTL_COMPRESS, which uses the standard Lempel-Ziv algorithm.

http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/u_compr.htm#BGBBCDDI

+3
source share

as_zip ( blog post ) is a proprietary PL / SQL package for managing ZIP archives.
It processes files up to 4 gigabytes in size (looks like a limitation of the original ZIP format).
The package is written by Anton Scheffer and licensed by MIT.

+3
source share

All Articles