AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Oralce exp doesn't work with Java runtime

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases
View previous topic :: View next topic  
Author Message
Boxer
Guest





PostPosted: Sat May 12, 2007 6:48 pm    Post subject: Oralce exp doesn't work with Java runtime Reply with quote



I was trying to run oracle exp through the java, code was like:

.....
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec("exp scott/tiger File=scott.dmp TABLES=(scott.
%)");
p.waitFor(); //this line will make the p hang!!! p can exit normally
without it.
....

But the program hang there never get finished.

I tried this:

.....
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec("exp scott/tiger File=scott.dmp TABLES=(scott.
%)");
Thread.sleep(10000); //obviously p has exited after this
System.out.println(""+p.exitValue());
....
the last line throws an exception saying the process has not exit yet.

The environment is Eclipse, Java 1.5, Junit

But I didn't find such behavior with calling sqlplus this way. Any
idea what make this EXP utility not working with java runtime?

Thx
Back to top
Ana C. Dent
Guest





PostPosted: Sat May 12, 2007 7:03 pm    Post subject: Re: Oralce exp doesn't work with Java runtime Reply with quote



Boxer <jianningw (AT) gmail (DOT) com> wrote in news:1178977735.858124.109000
@p77g2000hsh.googlegroups.com:

Quote:
I was trying to run oracle exp through the java, code was like:

....
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec("exp scott/tiger File=scott.dmp TABLES=(scott.
%)");
p.waitFor(); //this line will make the p hang!!! p can exit normally
without it.
...

But the program hang there never get finished.

I tried this:

....
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec("exp scott/tiger File=scott.dmp TABLES=(scott.
%)");
Thread.sleep(10000); //obviously p has exited after this
System.out.println(""+p.exitValue());
...
the last line throws an exception saying the process has not exit yet.

The environment is Eclipse, Java 1.5, Junit

But I didn't find such behavior with calling sqlplus this way. Any
idea what make this EXP utility not working with java runtime?

Thx



A couple of observations/comments:
AFAIK, TABLES= does not support the inclusion of schema owner.
On some/many/most OS the wild card character is "*"; not "%"
AFAIK, the TABLES= does not support use of any wild card character.

Have you tried:
exp scott/tiger File=scott.dmp OWNER=scott
Back to top
Boxer
Guest





PostPosted: Sat May 12, 2007 8:02 pm    Post subject: Re: Oralce exp doesn't work with Java runtime Reply with quote



using the shell command with:

exp dbaaccount/dbapwd@sid FILE=c:\scott.dmp TABLES=(SCOTT.%)

The program runs without any problem. BTW, the Oracle version is 9i
Back to top
Arne Vajhøj
Guest





PostPosted: Sun May 13, 2007 4:24 am    Post subject: Re: Oralce exp doesn't work with Java runtime Reply with quote

Boxer wrote:
Quote:
I was trying to run oracle exp through the java, code was like:

....
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec("exp scott/tiger File=scott.dmp TABLES=(scott.
%)");
p.waitFor(); //this line will make the p hang!!! p can exit normally
without it.
...

But the program hang there never get finished.

I tried this:

....
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec("exp scott/tiger File=scott.dmp TABLES=(scott.
%)");
Thread.sleep(10000); //obviously p has exited after this
System.out.println(""+p.exitValue());
...
the last line throws an exception saying the process has not exit yet.

The environment is Eclipse, Java 1.5, Junit

But I didn't find such behavior with calling sqlplus this way. Any
idea what make this EXP utility not working with java runtime?

If the exp command outputs any text, then you should read that
(and printing it may actually help you troubleshoot).

Arne
Back to top
Boxer
Guest





PostPosted: Sun May 13, 2007 7:10 am    Post subject: Re: Oralce exp doesn't work with Java runtime Reply with quote

I pipe and print from both the output and error stream of the exp
process sprawn by Java runtime. It doesn't printout any thing? That is
what make it so weird!
Back to top
tzvika.barenholz@gmail.co
Guest





PostPosted: Sun May 13, 2007 6:33 pm    Post subject: Re: Oralce exp doesn't work with Java runtime Reply with quote

In Windows, sometimes it helps to append cmd /c to the exectuable you
are running, i.e. to execute "cmd /c exp scott...."

T


On May 12, 4:48 pm, Boxer <jianni...@gmail.com> wrote:
Quote:
I was trying to run oracle exp through the java, code was like:

....
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec("exp scott/tiger File=scott.dmp TABLES=(scott.
%)");
p.waitFor(); //this line will make the p hang!!! p can exit normally
without it.
...

But the program hang there never get finished.

I tried this:

....
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec("exp scott/tiger File=scott.dmp TABLES=(scott.
%)");
Thread.sleep(10000); //obviously p has exited after this
System.out.println(""+p.exitValue());
...
the last line throws an exception saying the process has not exit yet.

The environment is Eclipse, Java 1.5, Junit

But I didn't find such behavior with calling sqlplus this way. Any
idea what make this EXP utility not working with java runtime?

Thx
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.