Home » RDBMS Server » Server Utilities » How to call Oracle sqlldr in Java
How to call Oracle sqlldr in Java [message #401660] Wed, 06 May 2009 00:22 Go to next message
Messages: 5
Registered: May 2009
Junior Member
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!!




import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class RunCmd
public static void main(String[] args)
Process P;
Runtime r;

r = Runtime.getRuntime();

try {
String[] cmd = new String[4];
cmd[0] = "cmd.exe";
cmd[1] = "/C";

cmd[2]="set PATH=C:\\OraHome_1\\bin;";

try {
P = r.exec(cmd);
int Exitcode = P.waitFor();
if (Exitcode != 0)
System.out.println("The command line job did not execute successfully");
System.out.println("The command line job - " +
" - executed successfully."); //break

catch (Exception e)

System.out.println(" 1 e.getMessage():"+e.getMessage());

} catch (Exception e)
System.out.println("2 e.getMessage():"+e.getMessage());

set PATH=C:\\OraHome_1\\bin;
C:\test2009\scripts\run_sqlldr.cmd test2009/test2009@orcl control=C:\test\scripts\ctl\amcare.ctl log=C:\test\scripts\log\NAC20090150005112.txt.log data=C:\test\scripts\data\NAC20090150005112.txt bad=C:\test\scripts\bad_files\NAC20090150005112.txt.bad discard=C:\test\scripts\dis_files\NAC20090150005112.txt.dis;

echo %* > C:\test2009\scripts\log\sqlldr.log
sqlldr %* >> C:\test2009\scripts\log\sqlldr.log
Re: How to call Oracle sqlldr in Java [message #401678 is a reply to message #401660] Wed, 06 May 2009 02:16 Go to previous messageGo to next message
Messages: 1734
Registered: December 2005
Location: NJ
Senior Member

Please check with Sun forum.

Re: How to call Oracle sqlldr in Java [message #401793 is a reply to message #401660] Wed, 06 May 2009 07:50 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10672
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Its windows code.
There is no way I can test it.
You do simple debug.
Instead of calling the sqlldr, just try to display to screen (system.out.println).
Post how the java runtime is calling sqlldr and its parameters.
Anything useful in sqlldr logfiles?
Re: How to call Oracle sqlldr in Java [message #401802 is a reply to message #401660] Wed, 06 May 2009 08:24 Go to previous message
Messages: 25349
Registered: January 2009
Location: SoCal
Senior Member
Previous Topic: SQL*Loader Syntax
Next Topic: import on the same user
Goto Forum:

Current Time: Tue Apr 25 08:05:12 CDT 2017

Total time taken to generate the page: 0.14132 seconds