I am trying to connect to SQL Server using pyodbc. I am facing the following problem: My username is: DESKTOP-B3DDLU2\maria
Login failed for user 'DESKTOP-B3DDLU2\\maria'
Any idea how to overcome the \\ instead of \ problem? I using the following code:
conn = pyodbc.connect(
r'DRIVER={SQL Server};'
r'SERVER=DESKTOP-B3DDLU2\SQLEXPRESS;'
r'DATABASE=[xxx];'
r'UID=DESKTOP-B3DDLU2'+('\\')+r'maria;'
r'PWD=xxxxx')
pyodbc. If you have the access level to do those, this is considered a better practice from a security standpoint as well (using a dedicated account for the service).SERVERandUIDboth start withDESKTOP-B3DDLU2.) If so, are you logged into Windows asDESKTOP-B3DDLU2\mariawhen you are running the Python code?MSSQL$SQLEXPRESSservice is something else entirely, no?