Hi Friends, I'm using -msqldump to backup the database in remote machine. If firewall is enabled i cannot login to the other hosts.Is there any solution for this problem.
I have posted the below coding in a web server and trying to backup from another domain.
String dumpCommand = "D:/MySQL/MySQL Server 5.0/bin/mysqldump -h"+scheduleInfo.get("hostName")+" -u"+scheduleInfo.get("user")+" -p"+scheduleInfo.get("password")+" "+scheduleInfo.get("dbName");
Runtime rt = Runtime.getRuntime();
try
{
Process proc = rt.exec(dumpCommand);
InputStream in = proc.getInputStream();
BufferedReader br=new BufferedReader(new InputStreamReader(in));
String line=null;
File directory=new File(context.getJobDetail().getDescription());
if(!directory.exists())
{
directory.mkdir();
}
File f=new File(directory.getAbsolutePath()+"\"+context.getTrigger().getJobName()+".sql");
System.out.println(f.getAbsolutePath());
FileWriter fw=new FileWriter(f,true);
fw.append("CREATE DATABASE /!32312 IF NOT EXISTS/ "+scheduleInfo.get("dbName")+"
/*!40100 DEFAULT CHARACTER SET latin1 */;\nUSE "+scheduleInfo.get("dbName")+"
;\n");
while((line=br.readLine())!=null)
{
System.out.println(line);
fw.append(line+"\n");
}
fw.close();
}