I tried to run the following code which is to create a backup of my database but it shows some run time errors.
But, I tried to run the Syst
I solved this problem by giving full path to mysqldump.exe
You can get SO environment variables by
Map env = System.getenv();
final String LOCATION = env.get("MYSQLDUMP");
I setup the system variable like this :
MYSQLDUMPD:\xampp\mysql\bin\mysqldump.exeNow just execute this code below,
String executeCmd = LOCATION+" -u " + DBUSER + " --add-drop-database -B " + DBNAME + " -r " + PATH + ""+FILENAME
Process runtimeProcess = = Runtime.getRuntime().exec(executeCmd);
Note : If you don't have configured password for mysql server just remove the -p PASSWORD attribute from the code. And don't forget to restart your computer after creating a new system variable.