它执行但不存储数据库备份,特别是floder
public class NewClass {
public static void main(String args[]) throws IOException, SQLException {
String dbName = "test";
String dbUser = "root";
String dbPass = "root";
try {
String executeCmd = "";
String[] comm = new String[4];
comm[0] = "C:\\Program Files\\MySQL\\MySQL Server 5.1\\bin\\mysqldump";
comm[1] = "-u " + dbUser;
comm[2] = "-p " + dbPass + " " + dbName;
comm[3] = "-r backup.sql";
Process runtimeProcess = Runtime.getRuntime().exec(comm);
int processComplete = runtimeProcess.waitFor();
if (processComplete == 0) {
System.out.println("Backup taken successfully");
} else {
System.out.println("Could not take mysql backup");
}
} catch (InterruptedException ex) {
Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
我需要存储 MySQL 数据库备份,那么编码中需要进行哪些更改