I use this code to import (restore) .sql file:
string command2 = "/ users / macbookpro / msql 5.6.16-oxac 7.7-x86_64 / bin / mysql - host mydb.ckwwsnbi2lvi.us-west-2.rds.amazonaws.com --port 3306-u xxx -pXXXX TestCom & Lt; / Users / MacBookPro / Download / Word3 SQL "Process Runtime Process; Try {runtimeProcess = Runtime.getRuntime (). Exec (command2); Processcomplete = runtimeProcess.waitFor (); If (processComplete == 0) {System.out.println ("Backup successfully restored"); // return true; } Else {System.out.println ("Backup could not be restored"); }} Hold (Exception pre) {ex.printStackTrace (); }The command is working well in the terminal, but when I run Java code it is not working Any help would be appreciated.
Thanks for helping the problem has been solved. I have the string array and '& lt;' Instead of using '-e source'.
This is the new command:
string [] command2 = new string [] {"/ user / macbookpro / micekill-5.6.16-OS x 10.7-x86_64 / User / "+ U," - password = "+ p," testcomm "," - e "," source "- / bin / misc", "- host =" + ad, "- port =" + pt, " + "/ Users / macbookpro / download / world3.sql"};
This is useful for me.
Comments
Post a Comment