How do I connect MS SQL Server using Windows Authentication, with the pyodbc library?
I can connect via MS Access and SQL Server Management Studio, but cannot get a working connection ODBC string for Python.
Here's what I've tried (also without 'Trusted_Connection=yes'
):
pyodbc.connect('Trusted_Connection=yes',
driver='{SQL Server}', server='[system_name]',
database='[databasename]')
pyodbc.connect('Trusted_Connection=yes', uid='me',
driver='{SQL Server}', server='localhost',
database='[databasename]')
pyodbc.connect('Trusted_Connection=yes',
driver='{SQL Server}', server='localhost',
uid='me', pwd='[windows_pass]', database='[database_name]')
pyodbc.connect('Trusted_Connection=yes',
driver='{SQL Server}', server='localhost',
database='[server_name]\\[database_name]')
pyodbc.connect('Trusted_Connection=yes',
driver='{SQL Server}', server='localhost',
database='[server_name]\[database_name]')
pyodbc.connect('Trusted_Connection=yes',
driver='{SQL Server}',
database='[server_name]\[database_name]')