Python MySQLdb 不工作 - 没有错误信息
有没有人知道我这里做错了什么?没有错误信息,脚本运行得很好,但就是没有记录插入到数据库里。直接在数据库上运行插入的查询是没问题的。
即使我输入一个假的IP或者密码,也不会产生任何错误。
我是在Windows上用Python 2.7和mysqldb 2.7的Windows版本。
import os, sys, time, glob, shlex, subprocess, MySQLdb
try:
db=MySQLdb.connect(host="my.sql.server.ip.here",user="encoding",passwd="passhere",db="encoding")
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit (1)
c=db.cursor()
c.execute("""INSERT INTO test (jobid, frame) VALUES (%s, %s)""",("asdf", "s[1]" ) )
c.close ()
db.close ()
1 个回答
3
自动提交功能被关闭。在断开连接之前,请先提交这个事务。