-1

I have a problem with an insert in python. All the attributes are correct and it gives no errors. Here is my code:

db = MySQLdb.connect(host="localhost", user="root", passwd="", db="ueberwachung") #Datenbank connection
cur = db.cursor()
cur.execute("INSERT INTO tereignisse VALUES('1002', '2016-12-02','18:34:15','/var/www/html/videos/2016-11-0103:21:13', '0')") 
cur.close()
db.close()

Edit: Sorry I forgot the problem. So problem: It doesn't write anything into the table.

Kenly
  • 24,317
  • 7
  • 44
  • 60
Sharpy
  • 33
  • 1
  • 6

1 Answers1

2

You need to commit the transaction before closing the connection:

db.commit()
cur.close()
db.close()
Soroush
  • 1,055
  • 2
  • 18
  • 26