File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes how to synchronize the databases(different locations) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "how to synchronize the databases(different locations)" Watch "how to synchronize the databases(different locations)" New topic
Author

how to synchronize the databases(different locations)

sureshreddy govindu
Greenhorn

Joined: Jun 08, 2011
Posts: 29
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

Joined: Jun 08, 2011
Posts: 29
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

Joined: Mar 18, 2011
Posts: 312

You should use MySQL' replication feature. Writing a custom Java code is not required as MySQL already provides this feature out-of-box.


S.D. MADHAN
Not many get the right opportunity !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to synchronize the databases(different locations)
 
Similar Threads
5 databases to synchronize
Synchronize two databases (MS SQL 2005)
Different Execution Plans for 2 instances of the same database.. Why??.. Help me out
Data synchronization bet practice?
Help on Sybase