1

when using Windows authentification with domain name and connection string to SQL Server (using Python34 and pyodbc), I still receive the following error:

cnxn = pyodbc.connect('DRIVER={SQL Server Native Client 11.0};SER
N04\SQLEXPRESS;DATABASE=BRKPNTD',UID='CZMKAJAN04\celocaladmin', PWD='xxxxxx')
pyodbc.Error: ('28000', "[28000] [Microsoft][SQL Server Native Client
Server]Login failed for user 'CZMKAJAN04\\celocaladmin'. (18456) (SQLDriverConnect)")

I don't know how to get rid of the double backslash, tried raw version of the string, various forms of escaping and nothing helped. Do you know how to solve it? Thanks a lot

1
  • Perhaps: cnxn = pyodbc.connect('DRIVER={SQL Server Native Client 11.0};SER N04\SQLEXPRESS;DATABASE=BRKPNTD;UID=CZMKAJAN04\\celocaladmin;PWD=xxxxxx') would work better. Commented Oct 20, 2015 at 14:00

1 Answer 1

2

Windows authentication for SQL Server connection strings requires the Trusted_Connection argument, it can't be specified using UID and PWD.

cnxn = pyodbc.connect('DRIVER={SQL Server Native Client 11.0};SERN04\SQLEXPRESS;DATABASE=BRKPNTD', Trusted_Connection='yes')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.