Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Running mysqldump query from java code

807589Aug 8 2008 — edited Aug 8 2008
Hello,

I m making a program I want to take a backup of database on a click of a button for which i want to execute this query :

"mysqldump --user=root --password=root --opt dbname>c:\backup.sql"

and my code is :

String command = "cmd /c start";

String[] env = new String[]{"mysqldump","--user=root", "--password=root",
"--opt", "njitsurvey", "<", "c:\\backup_db.sql" };

File dir = new File("C:/Program Files/MySQL/MySQL Server 5.0/bin/");

Process p1 = Runtime.getRuntime().exec(command, env, dir);

My problem is my command is running and going in to the directory also but not running my query and i m not getting and error also

Edited by: purva on Aug 7, 2008 11:56 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 5 2008
Added on Aug 8 2008
5 comments
457 views