Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- conn = mysql.connector.connect(database='test',
- user='usr',
- password='pwd',
- host='localhost',
- port=3306)
- # autocommit -> advice from web
- conn.autocommit = True
- print(conn.autocommit)
- cursor = conn.cursor()
- cursor.execute("SELECT * FROM testtable")
- rows = cursor.fetchall()
- # .... -> program stops here. please see output below
- res = len(rows)
- print(res)
- print(rows)
- cursor.close()
- conn.close()
Add Comment
Please, Sign In to add comment