Ho appena verificato che scrivendo correttamente la query da cmd.exe essa funziona ma mi esce il seguente messaggio:
Warning using a password on the command line interface can be insecure.
Naturalmente la stessa query da java non funziona!!
codice:
public static synchronized boolean backupDB(String filename) {
String curdir=System.getProperty("user.dir");
String [] executeCmd = {"mysqldump ","-u".concat(user)," -p".concat(password)," -B customers > ".concat(filename+".sql")};
Process runtimeProcess;
try {
runtimeProcess = Runtime.getRuntime().exec(executeCmd);
// int processComplete = runtimeProcess.waitFor();
/* System.out.println(executeCmd);
if (processComplete == 0) {
System.out.println("Backup created successfully");
return true;
} else {
System.out.println("Could not create the backup");
}
} catch (Exception ex) {
ex.printStackTrace();
}*/
} catch (IOException ex) {
Logger.getLogger(GestoreClienti.class.getName()).log(Level.SEVERE, null, ex);
}
return false;
}