This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
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

How to call Oracle sqlldr in Java

John Smith
Ranch Hand

Joined: Aug 21, 2004
Posts: 49
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, on the line for P.waitFor() it would freeze there forever:

Any help for suggestions would be greatly appreciated!!




Rob Spoor

Joined: Oct 27, 2005
Posts: 20132

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.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: How to call Oracle sqlldr in Java
It's not a secret anymore!