Hi;
I have the following code:

import MySQLdb
...
user, passwd, db, host = login()
db = MySQLdb.connect(host, user, passwd, 'cart')
cursor= db.cursor()
...
cursor.close()
db = MySQLdb.connect(host, user, passwd, db)
cursor= db.cursor()

Now, python complains about me opening a new connection. But I thought I'd
closed the first one! So, I replaced the last 3 lines with this:

cursor.execute('use %s;' % db)

but it didn't like that, either. Any way to switch databases?
TIA,
Victor
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to