_mysql_exceptions.ProgrammingError:(2014, "commands out of sync; you can't run this command now")
2013-09-09 10:47
239 查看
今天,测试dashboard上的一些graph, 发现,当多个graph同时向后台请求数据(异步)的时候, 出现了上述错误。而且,三个bug交替出现,另外两个bug分别是:python stop response 和mysql close closed connection。
查到最后,发现,因为ajax是异步请求的,而后台处理的时候,建立了一个connection以后,执行多条sql语句的时候,就出现了上述错误。
出错地方:
错误代码:
最终问题解决,改成一个connection,进行一个sql语句的查询。
查到最后,发现,因为ajax是异步请求的,而后台处理的时候,建立了一个connection以后,执行多条sql语句的时候,就出现了上述错误。
出错地方:
错误代码:
def ExceptionHandling_mysql(self,sql): try: cur = self.conn.cursor(libdb.cursors.DictCursor) rowcount = cur.execute(sql) self.conn.commit() result = cur.fetchall() while cur.nextset(): pass #if cur: #cur.close() except Exception, e: print 'This is mysql: %s' % (sql) print e result = [] #self.conn = libdb.connect(host=configeApp.getDBHost(), port=configeApp.getDBPort(), user=configeApp.getUserName(), #passwd=configeApp.getPwd(), db=configeApp.getDBase(), use_unicode=True, charset='utf8') if cur: cur.close() if self.conn: self.conn.close() return result
最终问题解决,改成一个connection,进行一个sql语句的查询。
相关文章推荐
- python mysql 2014 Commands out of sync; you can't run this command now
- MySQL问题一则:Commands out of sync; you can't run this command now以及相关问题
- error:2014 Commands out of sync; you can't run this command now
- C++ Mysql调用 错误:2014 :Commands out of sync; you can't run this command now
- 解决error:2014 Commands out of sync; you can't run this command now
- ERROR (ProgrammingError) (2014, "Commands out of sync; you can't run this command now")
- 解决error:2014 Commands out of sync; you can't run this command now
- python mysql 2014 Commands out of sync; you can't run this command now
- mysql 2014 error (2014) Commands out of sync; You can't run this command now命令不同步错误解决
- 使用otl,报错:mysql Commands out of sync; you can't run this command now
- mysql_query error:Commands out of sync;you can't run this command now
- php用mysql_query()调用存储过程后无法再执行sql报错:commands out of sync you can't run this command now
- PHP+MySQL连续插入数据报错:Commands out of sync; you can't run this command now & 读取Excel数据并批量插入到数据中
- 解决error:2014 Commands out of sync; you can't run this command now
- MySQL一次执行多条语句的实现及常见问题(C API Commands out of sync; you can't run this command now)
- mysql 出现 Commands out of sync; you can't run this command now
- 解决mysql error:2014 Commands out of sync; you can't run this command now
- MySQL一次执行多条语句的实现及常见问题(C API Commands out of sync; you can't run this command now)
- mysql: Commands out of sync; you can't run this command now
- 解决error:2014 Commands out of sync; you can't run this command now