使用Oracle存储过程压缩

使用Oracle存储过程压缩

本文介绍了使用Oracle存储过程压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,我正在使用Oracle实用程序过程UTL_COMPRESS.LZ_COMPRESS()压缩一些数据.但是问题是它使用GZIP兼容格式压缩文件,不幸的是,该格式也不是ZIP兼容格式.因此,Windows XP本机解压缩实用程序无法打开它(您知道压缩文件夹thingie).为了解压缩,用户必须使用其他实用程序,例如7ZipWinzipFilzip等.

Right now I am using Oracle utility procedure, UTL_COMPRESS.LZ_COMPRESS(), to compress some data. But the problem is it compresses the thing using GZIP compatible format, which is not also ZIP compatible unfortunately. Therefore, the Windows XP native decompression utility can not open it (you know that compressed folder thingie). And user have to use some other utility, like 7Zip, Winzip, or Filzip etc., in order to decompress that.

因此,我们最终有了一个计划,该计划是从Oracle检索GZIP数据,使用Java对其进行解压缩,然后将其压缩回ZIP(可以通过Windows实用程序进行解压缩). compress-in-gzip -> decompress -> compress-again-in-zip听起来很荒谬.

So, we end up having a plan of retrieving GZIP data from Oracle, uncompress it using Java, and compress it back to ZIP (something that can be decompressed by Windows utility). It sounds ridiculous to compress-in-gzip -> decompress -> compress-again-in-zip.

您知道如何首先将其压缩为所需格式,以避免所有这些额外的计算吗?

推荐答案

有一个Java包java.util.zip支持WinZip格式.在Oracle中,我们可以构建Java存储过程,以本地PL/SQL程序可以调用的形式显示Java类. 了解更多信息.

There is a Java package java.util.zip which supports the WinZip format. And in Oracle we can build java stored procedures which present Java classes in a form which can be called by native PL/SQL programs. Find out more.

因此,您需要做的是写出一个包含处于未压缩状态的数据的文件,然后通过JSP对其进行压缩以进行压缩.如果您不想编写自己的实现,请查看 Vadim Loevski的这篇文章.它包括用于压缩OS文件的Java存储过程.

So what you need to do is write out a file containing the data in its uncompressed state and then feed it through a JSP to zip it. If you don't want to write your own implementation then check out this article by Vadim Loevski. It includes a Java Stored Procedure for zipping OS files.

注意:在这种情况下,JSP表示Java存储过程,它是数据库中嵌入的Java程序.它与Web技术的Java Server Pages不同,因此是JSP首字母缩略词的更常用用法.如有任何混淆,我深表歉意.

Note: In this context JSP means Java Stored Procedure, which is a Java program embedded in the database. It is not the same as Java Server Pages, which is a web technology, and hence the more common usage for the JSP acronym. I apologise for any confusion given.

这篇关于使用Oracle存储过程压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 02:06