java执行EXP导出Oracle数据库并没有导出的文件生成
在网上搜了很多方法都没有解决
public static boolean EXP() {
Runtime rt = Runtime.getRuntime();
try {
Process p = rt.exec("cmd.exe EXP u/p@db..com:1521/ORCL FILE =D:\\ORACLE\\daochu.dmp tables=(AS_14)");
InputStream inputStream = p.getInputStream();
InputStream errorStream = p.getErrorStream();
writeToLocal("D:\\ORACLE\\zhengque.txt", inputStream);
inputStream.close();
writeToLocal("D:\\ORACLE\\cuowu.txt", errorStream);
errorStream.close();
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
private static void writeToLocal(String destination, InputStream input)
throws IOException {
int index;
byte[] bytes = new byte[1024];
FileOutputStream downloadFile = new FileOutputStream(destination);
while ((index = input.read(bytes)) != -1) {
downloadFile.write(bytes, 0, index);
downloadFile.flush();
}
downloadFile.close();
input.close();
return;
}