Problem with BACKUP and RESTORE MYSQL DATABASE
Hello everybody,
I have problem with mysql backup,
this is code
public boolean backupDB(String dbName, String dbUserName, String dbPassword, File path) {
String host="localhost";
FileWriter fw=null;
try{
fw = new FileWriter(path + ".sql");
Runtime rt = Runtime.getRuntime();
Process child = rt.exec("C:\\Program Files\\MySQL\\MySQL Server 5.1\\bin\\mysqldump -h"+host+" -u"+dbUserName+" -p"+dbPassword+" finindex");
JOptionPane.showMessageDialog(null, "Копия база данных успешно завершена !", "Внимание!", JOptionPane.INFORMATION_MESSAGE);
InputStream in = child.getInputStream();
InputStreamReader xx = new InputStreamReader(in,"utf8");
char[] chars=new char[1024];
int ibyte=0;
while((ibyte=xx.read(chars))>0)
{
fw.write(chars);
}
fw.close();
}catch (Exception e1) {
e1.printStackTrace();
}
return false;
}
problem, in some computer it's work normal in same don't work.
where is problem, the mysqldump directory is ok.
Thank you !
Re: Problem with BACKUP and RESTORE MYSQL DATABASE
What is that didn't work? Can you post any error message that you saw while running your program? Are you running you application under the same operating system?
Re: Problem with BACKUP and RESTORE MYSQL DATABASE
this code work normal but the file is created .sql file size is 0
Re: Problem with BACKUP and RESTORE MYSQL DATABASE
yes I run my program in Win 7, Win Xp
Re: Problem with BACKUP and RESTORE MYSQL DATABASE
Could it be an authentication issue, like you don't have access from the other computer to your database?