Maaf teman-teman saya buka lagi arsip lama dari mas Bowo, mas Bowo saya
sudah coba solusi dari mas Bowo dibawah ini, dan ketika dijalankan keluar
pesan 'PL/SQL procedure successfully completed' ,  tapi kenapa hasilnya
tidak ada? (Zip file tidak terbentuk). Apa saja yang harus saya perhatikan
sebelum menjalankan procedure ini? Sebagai informasi saya punya text file
yang akan saya compress di directory /u02/test.txt yang letaknya di database
server yang menggunakan os RHEL ver 4 for OpenPower.

Demikian problem saya,mohon pencerahan dari mas Bowo dan teman-teman.

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Yulius Wibowo
Sent: 05 Juli 2006 10:24
To: [email protected]
Subject: [indo-oracle] Re: Output PL-SQL ke zip

UTL_COMPRESS hanya ada mulai database 10G.

Alternatif lain, anda bisa membuat program menggunakan Java di dalam 
database. Berikut ini contoh program yg saya kutip dari sebuah 
source.


CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "UTLZip" AS
import java.util.zip.*;
import java.io.*;
public class UTLZip
{
 public static void compressFile(String infilename, String 
outfilename)
 {
  try
    {
     FileOutputStream fout = new FileOutputStream(outfilename);
     ZipOutputStream zout = new ZipOutputStream(fout);
     ZipEntry ze = new ZipEntry((new File(infilename)).getName());
     try 
       {
        FileInputStream fin = new FileInputStream(infilename);
        zout.putNextEntry(ze);
        copy(fin, zout);
        zout.closeEntry();
        fin.close();
       }
     catch (IOException ie)
     {
      System.out.println("IO Exception occurred: " + ie);
     }
     zout.close();
    }
  catch(Exception e)
    {
     System.out.println("Exception occurred: " + e);
    }
 }
  
 public static void copy(InputStream in, OutputStream out) 
      throws IOException
 { 
  byte[] buffer = new byte[4096];
  while (true) {
    int bytesRead = in.read(buffer);
    if (bytesRead == -1) break;
    out.write(buffer, 0, bytesRead);
  }
 }     
}
/

CREATE OR REPLACE PACKAGE UTLZip
IS
   PROCEDURE compressFile (p_in_file IN VARCHAR2, p_out_file IN 
VARCHAR2)
   AS
      LANGUAGE JAVA
         NAME 'UTLZip.compressFile(java.lang.String, 
                   java.lang.String)';
END;
/

Contoh penggunaannya:

SQL> exec UTLZip.compressFile 
('/home/oracle/test.txt','/home/oracle/test.zip')


Bowo


--- In [email protected], "Yulius Wibowo" 
<[EMAIL PROTECTED]> wrote:
>
> Pakai UTL_COMPRESS
> 
> Bowo
> 
> --- In [email protected], Rahandra Pramono <RPramono@> 
> wrote:
> >
> > Dear all,
> > 
> >  
> > 
> > Ada yang tau gak gimana melakukan kompresi langsung untuk output 
> dari
> > pl-sql?
> > 
> > Package yang dipakai apa ya?
> > 
> > Atau Cuma ada satu cara dengan  menggunakan kompresi dari system?
> > 
> >  
> > 
> > Mohon pencerahannya ya
> > 
> >  
> > 
> > Terima kasih
> > 
> >  
> > 
> > 
> > 
> > [Non-text portions of this message have been removed]
> >
>








--
-----------I.N.D.O - O.R.A.C.L.E---------------
Keluar: [EMAIL PROTECTED]
Website: http://indo-oracle.blogspot.com
Mirror: http://indooracle.wordpress.com
-----------------------------------------------

Bergabung dengan Indonesia Thin Client User Groups, 
Terminal Server, Citrix, New Moon Caneveral, di:
http://indo-thin.blogspot.com 
Yahoo! Groups Links



Kirim email ke