A community member has associated this post with a similar question:
Azure Synapse database: How to fix HY000 "login failed" error

Only moderators can edit this content.

Azure Synapse database: How to fix HY000 "login failed" error

Chuck Roberts 65 Reputation points
2024-05-23T10:46:48+00:00

I'm getting an error when using my Python program to connect to an Azure Synapse MS SQL server.

My info:

  1. Using Python 3.11 on Windows 10 Pro. And using the pyodbc 5.1.0 module.
  2. Server: [blahserver.sql.azuresynapse.net]. This is an Azure Synapse MS SQL server. I do not have admin access to this server but I can use it via Power BI just fine using my Active Directory login info.
  3. Port: 1433
  4. This is my first time using the server via Python. I connect to this SQL server fine in Power BI.
  5. We use an Active Directory for login info.
  6. Connection string: DRIVER={ODBC Driver 18 for SQL Server};[SERVER=blahserver.sql.azuresynapse.net][;DATABASE=mydbname;UID=myser@email.com];PWD=mypwd

I installed the MS ODBC driver on my laptop. And installed pyodbc for my program in Test\piecework. When my Python program tries to connect to the database on Azure I get this error:

  • pyodbc.Error: ('HY000', '[HY000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Cannot open server "[xxx.com]" requested by the login. The login failed. (40532) (SQLDriverConnect); [HY000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Cannot open server "[xxx.com]" requested by the login. The login failed. (40532)')

But xxx.com is not any part of my server name.

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,553 questions
{count} votes