Hi;<div>I have the following code:</div><div><br></div><div><div>import MySQLdb</div><div>...</div><div><div>user, passwd, db, host = login()</div><div>db = MySQLdb.connect(host, user, passwd, 'cart')</div><div>cursor= db.cursor()</div>
<div>...</div><div><div>cursor.close()</div><div>db = MySQLdb.connect(host, user, passwd, db)</div><div>cursor= db.cursor()</div><div><br></div><div>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:</div>
<div><br></div><div>cursor.execute('use %s;' % db)</div><div><br></div><div>but it didn't like that, either. Any way to switch databases?</div><div>TIA,</div><div>Victor</div></div></div></div>