0

I am writing a python script that connects to Azure Serverless SQL and exports the rows for a given query. I am using sqlalchemy. I build the connection string

connection_string = 'DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';Authentication=ActiveDirectoryInteractive;Encrypt=yes;TrustServerCertificate=no;UID='+username

and it prompts for a password as expected

When I change it to this

connection_string = 'DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';Encrypt=yes;TrustServerCertificate=yes;UID='+username+';PWD ='+password+';Authentication=ActiveDirectoryPassword'

It throws this message

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

How can I get it not to prompt for a password on the connection since I prompt for it before hand. Since I am running several python scripts that do this, I only want to have to enter my password once.

I am using version 17.10.6.1 on a windows 11 machine

3
  • What exact version of ODBC Driver 17 for SQL Server are you using? Some Authentication methods are only available in recent versions of the driver, some are only available on Windows clients. Commented May 21 at 21:30
  • I am using version 17.10.6.1 on a windows 11 machine Commented May 22 at 13:28
  • I also have ODBC Version 18 available on my machine Commented May 22 at 13:36

0

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.