Ich bin Backup-ed eine Datenbank in Java mit mysqldump Befehl und jetzt möchte ich diese Datei zurück hier ist mein Code, aber es erstellt eine mysqlid und reagiert nichts und auch es Die Datei wird nicht wiederhergestellt.Wie man eine Datenbank-Backup-Datei mit Java wiederherstellen
restore.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
// JFileChooser fc = new JFileChooser();
//
// fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
// int result = fc.showOpenDialog(frame);
// if (result == JFileChooser.APPROVE_OPTION) {
// File file = fc.getSelectedFile();
// pathTobeSaved = file.getAbsolutePath();
//}
// JOptionPane.showMessageDialog(null, "Starting");
// String cmd = "mysql -u root -h localhost mysqlsarafi < C:\\xampp\\htdocs\\backup.sql";
// JOptionPane.showMessageDialog(null, "Waiting");
Process runtime = Runtime.getRuntime().exec("mysql -u root mysqlsarafi < C:\\xampp\\htdocs\\backup.sql");
JOptionPane.showMessageDialog(null, "Done");
int complete = runtime.waitFor();
JOptionPane.showMessageDialog(null, complete);
if(complete ==0){
JOptionPane.showMessageDialog(null, "Succed");
}
else{
JOptionPane.showMessageDialog(null, "not succed");
}
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
bitte helfen Sie mir aus diesem Problem – Noorullah