package com.jyc.sqlldr;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
public class SqlldrtTest {
public static void main(String[] args) {
// String
// cmd="D:/oracle/ora92/bin/sqlldr userid=test/test@testdb skip=1 control=e:/test.ctl bad=e:/bad.txt";
String cmd = "d:/db/oracle/product/10.2.0/db_2/bin/sqlldr userid=jyc/jyc@orcl control=C:/mycontrl.ctl bad=c:/bad.txt";
try {
Process ldr = Runtime.getRuntime().exec(cmd);
InputStream stderr = ldr.getInputStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null)
System.out.println("*** " + line);
stderr.close();
isr.close();
br.close();
try {
ldr.waitFor();
} catch (Exception e) {
System.out.println("process function:loader wait for != 0");
}
} catch (Exception ex) {
System.out.println("process function:loader execute exception"
+ ex.toString());
}
}
}