2011-02-25 51 views
2

任何想法我在做什么错在这里?没有错误消息,脚本运行正常,但没有记录插入到数据库中。在数据库上运行插入查询可以正常工作。python mysqldb无法正常工作 - 无错误信息

即使我放入一个伪造的IP或密码,也不会产生错误。

这是在窗口与python 2.7和mysqldb 2.7窗口二进制文件。

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() 

回答

3

自动提交功能被禁用。在断开连接之前提交事务。