I want to dump or backup a mysql database on button click, i have the following logic, no errors bt it cant execute, can anyone help me in identifying the error. the code as follows:
try {
String dbName = "xxx";
String dbUser = "root";
String dbPass = "";
String excecuteCmd = "";
excecuteCmd = "/C:/Program Files/MySQL/MySQL Server 5.0/bin/mysqldump.exe -u" + dbUser + " -p"+ dbPass + "" + dbName+" > xxxdb_bckp.sql";
Process runtimeProcess = Runtime.getRuntime().exec(excecuteCmd);
int processComplete = runtimeProcess.waitFor();
if(processComplete == 0)
{
JOptionPane.showMessageDialog(null, "Backup Succesful");
}
else
{
JOptionPane.showMessageDialog(null, "Backup Failed");
}
}
catch(Exception expn)
{
JOptionPane.showMessageDialog(null, expn);
}
it notifies that backup failed.