Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 796
  • Last Modified:

Run gzip and sqlldr on UNIX

I need to have a program to run gzip first, it will unzip the data.txt.gz file. Then I will usse this program to run sqlldr. I need to run this program on UNIX. I know how to run sqlldr in java, any suggestion?

Thanks.
0
jen2483
Asked:
jen2483
1 Solution
 
CEHJCommented:
Runtime.getRuntime().exec("gunzip data.txt.gz");
0
 
CEHJCommented:
(Since you say you know how to run sqlldr in Java, i assume that's all you need help with...)
0
 
Tommy BraasCommented:
Hi jen2483,

Using a GZIPInputStream would allow you not to rely on gzip being installed on the system.

\t
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Tommy BraasCommented:
jen2483,

Try this:

            FileInputStream fis = new FileInputStream("data.txt.gz");
            GZIPInputStream gzis = new GZIPInputStream(fis);
            byte []buffer = new byte[1024];
            FileOutputStream fos = new FileOutputStream("data.txt");
            int len = 0;
            while ( (len = gzis.read(buffer, 0, len)) != -1)
            {
                fos.write(buffer, 0, len);
            }
            gzis.close();
            fis.close();
            fos.close();
0
 
objectsCommented:
heres an example of running exec() if you decide to use that route, though using GZIPInputStream would be a cleaner approach.

http://www.objects.com.au/java/examples/util/ConsoleExec.do
0
 
sciuriwareCommented:
WARNING!

     GZIPInputStream fails on files that expand to > 4Gb

In that case you are forced to use gunzip.
;JOOP!
0
 
CEHJCommented:
8-)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now