Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to call Oracle sqlldr in Java

 
John Smith
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20546
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic