Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Running mysqldump from java in linux

$
0
0
--The following command works fine when run directly on terminal

mysqldump -uabc -pabc1234 --compact --no-create-info -w \"fieldname != 'A'\" dbname tablename -hhostaddress --result-file=/tmp/myfile.txt


--But when it is executed using Runtime() method then it does not produce the output in the destination file.

String s="mysqldump -uabc -pabc1234 --compact --no-create-info -w \"fieldname != 'A'\" dbname tablename -hhostaddress --result-file=/tmp/myfile.txt";
Runtime.getRuntime().exec(s);


(--say abc is the username and abc1234 the password)

The same problem occurs if redirection to the destination file ( > ) is usedinstead of --result-file option.
What shall i do to execute it from within a java program ?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>