aspose file tools*
The moose likes JDBC and the fly likes Check status of MySQL replication with JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Check status of MySQL replication with JDBC" Watch "Check status of MySQL replication with JDBC" New topic
Author

Check status of MySQL replication with JDBC

Martin Wingert
Greenhorn

Joined: Oct 10, 2005
Posts: 16
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

Joined: Oct 10, 2005
Posts: 16
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30548
    
152

Thanks for sharing that Martin. And welcome to JavaRanch!


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Check status of MySQL replication with JDBC