Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to synchronizing master database with slave database

 
ls klu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello All,

I have two databases running in two servers. i need to use java implement synchronize master-slave database.

when i insert data in master database table1(name, boolean), it should be automatic insert into slave database table1 (name, only when boolean is true).

any suggestions how should i start with this?

thanks in advance!
 
K. Tsang
Bartender
Posts: 3585
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

When database needs to synchronize data, it usually done through replication using the database provided tools. This will mean the primary database is the one user insert/update/retrieve data and let the database do the replicating to the secondary database in its own time frame. I'm sure this time frame can be set long or short.

when i insert data in master database table1(name, boolean), it should be automatic insert into slave database table1 (name, only when boolean is true).


Given your requirement, if replication is used, the slave database will have data that are boolean=false too. I'm no DBA maybe it can choose what data to replicate. So do check with your DBA first.

If nothing seems to work, then you would have to manually insert into both databases.
 
ls klu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks K.Tsang.

i think also use java monitore the timestamp and primary key to decide if a new record inserted.

i mean when the master db table1 boolean is false, this record will not share for slave, will not replicate to other slave databanks.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic