Hola como estan
tengo lo siquiente codigo pero no me recupera restaura la BD talvez alguien sabe donde tengo el error
try {
JFC_Backup.setVisible(true);
String bd = "test";
int result = JFC_Backup.showOpenDialog(null);
if(result == JFileChooser.OPEN_DIALOG)
{
File bkp;
bkp = JFC_Backup.getSelectedFile();
String arq = bkp.getPath();
System.out.println("bd "+ bd);
System.out.println("arq "+ arq);
String[] cmd = new String[3];
cmd[0] = "cmd.exe" ;
cmd[1] = "/C" ;
cmd[2] = "C:/xampp/mysql/bin/mysql" -u root -p -h localhost "+bd+" < "+arq;
Runtime rt = Runtime.getRuntime();
System.out.println("Execing " + cmd[0] + " " + cmd[1]);
proc = rt.exec(cmd);
// any error message?
StreamGobbler errorGobbler = new
StreamGobbler(proc.getErrorStream(), "ERROR");
// any output?
StreamGobbler outputGobbler = new
StreamGobbler(proc.getInputStream(), "OUTPUT");
// kick them off
errorGobbler.run();
outputGobbler.run();
// any error???
int exitVal = proc.waitFor();
if (exitVal == 0)
{
JOptionPane.showMessageDialog(null, "Backup Restaurado com sucesso !");
}
else
{
JOptionPane.showMessageDialog(null, "Falha ao restaurar backup. \n Verifique as configurações ou entre em contato com o suporte !");
}
}
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e, "Erro!", 2);
}
}