I connect to MySql this way:
import MySQLdb
cnn = MySQLdb.connect(user="login", passwd="passwd", db="some db") # subject to hang
cur = cnn.cursor()
cur.execute("some sql") # subject to hang
cnn.commit() # maybe subject to hang
cur.close()
On my server theoretically, the MySql might crash or something and I want to ensure that those methods don't take infinite time to execute. I want to be able to specify a timeout or "reset" or cancel their execution.
Is there any way?