Documentation Home
MySQL Connector/Python Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 0.6Mb
PDF (A4) - 0.6Mb
HTML Download (TGZ) - 82.9Kb
HTML Download (Zip) - 95.5Kb


10.2.27 MySQLConnection.ping() Method

Syntax:

cnx.ping(reconnect=False, attempts=1, delay=0)

Check whether the connection to the MySQL server is still available.

When reconnect is set to True, one or more attempts are made to try to reconnect to the MySQL server, and these options are forwarded to the reconnect()>method. Use the delay argument (seconds) if you want to wait between each retry.

When the connection is not available, an InterfaceError is raised. Use the is_connected() method to check the connection without raising an error.

Raises InterfaceError on errors.


User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
  Posted by duke ca on March 1, 2016
The syntax would is :
ping(reconnect=False, attempts=1, delay=0)
Sign Up Login You must be logged in to post a comment.