sql loader from java
Hi
I try running the program in command prompt its working ,but when i try run from my java application its not working .
I am trying to run the code
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Scanner;
class Test2
{
public static void main(String cmd[]) {
String str = "";
System.out.println("Enter command ");
Scanner sc = new Scanner (System.in);
String a=sc.next();
try {
System.out.println("\nEntering runBCP() ......");
Process process_bcp = Runtime.getRuntime().exec(a);
process_bcp.waitFor();
int returnValue = process_bcp.exitValue();
System.out.println("\nin runBCP(), returnValue = " +returnValue);
if(returnValue != 0) {
InputStream in = process_bcp.getInputStream();
InputStreamReader preader = new InputStreamReader(in);
BufferedReader breader= new BufferedReader(preader);
String msg = null;
while((msg = breader.readLine()) != null) {
System.out.println(msg);
str += "" + msg + "";
}
System.out.flush();
preader.close();
breader.close();
in.close();
InputStream inError = process_bcp.getErrorStream();
InputStreamReader preaderError = new InputStreamReader(inError);
BufferedReader breaderError= new BufferedReader(preaderError);
String errorMsg = null;
while((errorMsg = breaderError.readLine()) != null) {
System.out.println("Copy Error: " + errorMsg);
str += "" + errorMsg + "";
}
System.out.flush();
preaderError.close();
breaderError.close();
inError.close();
}
else{
InputStream in = process_bcp.getInputStream();
InputStreamReader preader = new InputStreamReader(in);
BufferedReader breader= new BufferedReader(preader);
String msg = null;
while((msg = breader.readLine()) != null) {
System.out.println(msg);
str += "" + msg + "";
}
System.out.flush();
preader.close();
breader.close();
in.close();
}
process_bcp.destroy();
System.out.println("IMPORT PORTFOLIO DATA DONE");
}catch(InterruptedException e){
System.out.println("Exception : " + e.toString());
e.printStackTrace();
str = "UPLOAD FAILED";
}catch(Exception e){
str = "UPLOAD FAILED";
System.out.println("Exception : " + e.toString());
e.printStackTrace();
}
System.out.println(str);
}
}
when i enter by
sqlldr userid=System/Violet415 control=loader1.ctl log=loader.log
nothing comes up . Can you please tell me where to control file and data file in eclipse .
loader1.ctl(control file)
load data
INFILE 'loader2.dat'
INTO TABLE uel
TRUNCATE
FIELDS TERMINATED BY ','
(article_id SEQUENCE (MAX,1),
author CHAR(30),
format,
pub_date SYSDATE,
title,
ext_fname FILLER CHAR(80),
text LOBFILE(ext_fname) TERMINATED BY EOF)
please can any body help me in this regards . Thank you in advance