Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Check status of MySQL replication with JDBC

 
Martin Wingert
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written a system check application in Java that among other things check if the database replication in MySQL is running. Currently it checks a timestamp in a transaction table and that it's not to old on the slave side.

The problem is that big reports lock the transaction table that I'm checking on the slave and therefore prevents the check application to execute properly.

So to my question: does anyone know how to execute the "show slave status" command in MySQL through the JDBC interface? Or have any other idea on how to check that the replication are working that doesn't involve creating new tables in the database just to store some kind of timestamp of the last update.

Thanks
Martin
 
Martin Wingert
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found the pretty simple solution to my "problem". It's possible to execute the query "show slave status" through an ordinary statement and get the replication status.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34672
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for sharing that Martin. And welcome to JavaRanch!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic