File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to call Oracle sqlldr in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to call Oracle sqlldr in Java" Watch "How to call Oracle sqlldr in Java" New topic
Author

How to call Oracle sqlldr in Java

John Smith
Ranch Hand

Joined: Aug 21, 2004
Posts: 48
Hi All:

I am using windows 2000 server with Eclipse.
In the dost prompt, I ran the file run_sqlldrTest2.cmd and it loaded record into the Oracle database.
I tried to do the same thing in java calling the run_sqlldrTest2.cmd. In java it states the "The command line job - -executed successfully."
However, I donot see the record being loaded into the database.
What am I doing wrong?

If I comment out the "cmd[2]=set PATH=C:\\OraHome_1\\bin;" line and ran RunCmd.java, on the line for P.waitFor() it would freeze there forever:

Any help for suggestions would be greatly appreciated!!

Yours,

Frustrated.



RunCmd.java:

run_sqlldrTest2.cmd:


run_sqlldr.cmd:
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

You should read the JavaWorld article "When Runtime.exec() won't" first. That could solve the freezing.

Also, there is no need to set the PATH in the command itself; Runtime.exec() is overloaded, and with some of these overloaded methods you can set environment variables. It clears all other environment variables though, but if these do not matter then that's not a problem.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to call Oracle sqlldr in Java