79197201

Date: 2024-11-17 12:43:05
Score: 0.5
Natty:
Report link

In reply to Maurice

Using MySql I use this code:

import mysql.connector
cnx = mysql.connector.connect(user='root', password='Aragorn_2024', 
host='127.0.0.1',  database='Aragorn')
cur = cnx.cursor()
cur.execute("INSERT INTO sakila.tempora SELECT sysdate()")
for row in cur.fetchall():
    print (row[0])
cnxn.close())

Using ODBC, the code looks like this: import pyodbc cnx = pyodbc.connect('DRIVER={Devart ODBC Driver for SQL Server};Server=127.0.0.1;Database=Aragorn;Port=3306;UserID=root;Password=Aragorn_2024') cur = cnx.cursor() cur.execute("INSERT INTO sakila.tempora SELECT sysdate()") for row in cur.fetchall(): print (row[0]) cnxn.close()

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Joop Moerkens