ODBC DSN (SQL Server 18 driver) can't connect to Azure hosted database using ActiveDirectoryServicePrincipal

Michael Aiello 0 Reputation points
2024-11-20T21:48:56.5366667+00:00

I have an ODBC DSN set up using SQL Server ODBC driver 2018.184.01.01. I can connect to my Azure hosted database using this DSN in Python, with the DSN, UID, PWD in the connection string. However attempting the same connection string using the C language SQLDriverConnect() function always fails, reporting:

State: CE275
[Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Error requesting access token, HTTP status 400, expected 200

I am also able to create a working JDBC connection with the same credentials. Only fails from C code.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,059 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.