Backup mysql by java

1

Good afternoon, I have a cmd that correctly backs up my database, but when running in java it does not open the cmd in the expected way, it follows the code:

package sistemaMiriam.backup;

import java.io.IOException;

public class MySQLBackup {
public static void main(String[] args){
    String comando = "C:\xampp\mysql\bin\mysqldump sistema_miriam -u root -p ";
    try {
        Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL "+comando);

    } catch (IOException e) {
        e.printStackTrace();
    }
}
}

If I put C:\xampp\mysql\bin\mysqldump sistema_miriam -u root -p >nomeParaArquivo.sql it executes >nomeParaArquivo.sql as if it were a table and not create a file with the bd data

    
asked by anonymous 28.04.2016 / 19:58

1 answer

-1
What might be happening is that you are not allowed to execute files in the specified directory (C: \ Program Files (x86) \ EasyPHP-DevServer-14.1VC11 \ binaries \ mysql \ bin \ _sqldump.bat). Try running a test on a directory you created at the root of C: \ or D: \. If this is the problem try running the java program with administrator permissions.

    
08.05.2016 / 05:36