Solved

Run gzip and sqlldr on UNIX

Posted on 2004-10-19
7
750 Views
Last Modified: 2008-03-10
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
Comment
Question by:jen2483
7 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
Comment Utility
Runtime.getRuntime().exec("gunzip data.txt.gz");
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
(Since you say you know how to run sqlldr in Java, i assume that's all you need help with...)
0
 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
Hi jen2483,

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

\t
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
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
 
LVL 92

Expert Comment

by:objects
Comment Utility
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
 
LVL 24

Expert Comment

by:sciuriware
Comment Utility
WARNING!

     GZIPInputStream fails on files that expand to > 4Gb

In that case you are forced to use gunzip.
;JOOP!
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
8-)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countAbc challenge 9 49
HashMap Vs TreeMap 12 47
recursion example 16 66
Cipher Configuration on Apache HTTPD 4 15
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now