1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
package test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class SimplePOJOExample {
public static void main(String[] args) throws Exception {
try{
long start = System.currentTimeMillis();
Process p = Runtime.getRuntime().exec(new String[]{
//C:\wamp\bin\mysql\mysql5.5.20\bin>mysqldump -u root dbv2 > c:\dbv2.sql
"C:\\wamp\\bin\\mysql\\mysql5.5.20\\bin\\mysqldump",
"-u",
"root",
"dbv2"
});
//p.waitFor();
StringBuffer condition = new StringBuffer();
BufferedReader in
= new BufferedReader(new InputStreamReader(p.getInputStream()));
String s;
while ((s = in.readLine()) != null) {
condition.append(s);
condition.append("\n");
}
System.out.println(condition.toString());
long endTime = System.currentTimeMillis();
System.out.println("Total elapsed time in execution of method Insert is :"
+ (endTime - start));
//System.out.println(p.getOutputStream());
//System.out.println(p.getErrorStream());
}catch (Exception e) {
// TODO: handle exception
System.out.println(e);
}
}
} |