help with this simple DB script

John Salerno johnjsal at NOSPAMgmail.com
Tue May 16 21:09:17 EDT 2006


Ok, before I contact my server host, I figured I should make sure I'm 
not just making a Python mistake. I get an Internal Server Error with 
this script:

!#/usr/bin/python

import MySQLdb

db = MySQLdb.connect(host='xxx',
                      user='xxx',
                      passwd='xxx',
                      db='xxx') # changed this stuff

cursor = db.cursor()
cursor.execute("CREATE TABLE test (first varchar(10), second number(2))")
cursor.execute("INSERT INTO test (first, second) VALUES ('Hello', 33)")
cursor.execute("SELECT first, second FROM test")
cursor.fetchall()
cursor.close()
db.close()



All I do is run it directly with my URL, not sure if there's more to it.



More information about the Python-list mailing list