This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile 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: 34084
337
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