I have a script that waits until some row in a db is updated:
con=MySQLdb.connect(server,user,pwd,db)
when the script starts the row's value is "running"
, and it waits for the value to become "finished"
while(True):
sql='''select value from table where some_condition'''
cur=self.getCursor()
cur.execute(sql)
r=cur.fetchone()
cur.close()
res=r['value']
if res=='finished':
break
print res
time.sleep(5)
When I run this script it hangs forever. Even though I see the value of the row has changed to "finished" when I query the table, the printout of the script is still "running"
.
Is there some setting I didn't set?
EDIT (to prevent confusion):
The python script only queries the table. The update to the table is carried out by a tomcat webapp, using JDBC, that is set on autocommit.