Solved

Run gzip and sqlldr on UNIX

Posted on 2004-10-19
7
785 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 86

Accepted Solution

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

Expert Comment

by:CEHJ
ID: 12351092
(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
ID: 12351945
Hi jen2483,

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

\t
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 14

Expert Comment

by:Tommy Braas
ID: 12351984
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
ID: 12352929
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
ID: 12355373
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
ID: 12456232
8-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
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 …

630 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