Архив метки: Trusted_Connection

Python подключение к базе данных MSSQL

import pyodbc
cnxn = pyodbc.connect("Driver={SQL Server};"
                      "Server=srvmssql;"
                      "Database=mydatabase;"
                      "Trusted_Connection=yes;")
cursor = cnxn.cursor()
cursor.execute('SELECT TOP 10 * FROM MYTABLE')
for row in cursor:
    print('row = %r' % (row,))
input()