I am trying to connect to a SQL Server database with Python using this code:
conn = pyodbc.connect(
r'Driver={SQL Server Native Client 11.0};'
r'Server=12345.dcd_ba.weatherton.com;'
r'Database=Dentrix;'
r'Trusted_Connection=no;'
r'Integrated security=false;'
r'username=fred;'
r'password=test;'
)
return conn
But I am getting this error:
pyodbc.InterfaceError: ('28000', "[28000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user ''. (18456) (SQLDriverConnect); [28000] [Microsoft][SQL Server Native Client 11.0]Invalid connection string attribute (0); [28000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user ''. (18456); [28000] [Microsoft][SQL Server Native Client 11.0]Invalid connection string attribute (0)")