Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to synchronize the databases(different locations)

 
sureshreddy govindu
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,


having mysql database running at different locations., i want to synchronize all the databases by end of the day. how achieve it., through java program???
(i thing running the timer job at exactly end of the day. and export databases and send it through mail., ) it's good way or not???
 
sureshreddy govindu
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to back up mysql dump from java ., below program not running., (exception occur)

package scjp;

import java.io.*;
public class sampledb1 {

public static void main(String[] args) {


try {



Runtime rt = Runtime.getRuntime();

rt.exec("/C:/Program Files/MySQL/MySQL Server 5.0/bin/mysqldump -u [root] -p[tiger] [ mysql] -r /D:/backup.sql");
}

catch(IOException ioe)
{
ioe.printStackTrace();
}

catch(Exception e) {
e.printStackTrace();
}
}}


Exception is ::

java.io.IOException: Cannot run program "/C:/Program": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at scjp.sampledb1.main(sampledb1.java:15)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 5 more
 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should use MySQL' replication feature. Writing a custom Java code is not required as MySQL already provides this feature out-of-box.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic