Connection sring forAzure Synapse

Harsh Singh 0 Reputation points
2024-12-03T00:40:32.3033333+00:00

I am attempting to connect to Azure Synapse using the provided connection string, but I keep encountering the error message: "Could not connect to Database. Error number: 80004005 Login timeout expired." The connection string I am using is as follows:
Provider=MSOLEDBSQL; Data Source=xxxxx.sql.azuresynapse.net; Initial Catalog=MyDB; Authentication=ActiveDirectoryPassword; User ID=XXXX; Password=XXXX; Use Encryption for Data=true.

I have successfully established a connection from SQL Server Management Studio (SSMS) using the same authentication method, and the test connection with the ODBC Driver 17 for SQL Server (64-bit) also succeeds.

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.
5,379 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Chandra Boorla 14,675 Reputation points Microsoft External Staff Moderator
    2024-12-05T10:11:53.5466667+00:00

    @Harsh Singh

    Glad to hear that the server's name issue was resolved. Regarding the new error, "Invalid connection string attribute," this typically occurs when there is an unsupported or incorrectly formatted parameter in the connection string.

    To connect to Azure Synapse using a connection string with Active Directory authentication, you can use the following format. Ensure that you replace the placeholders with your actual server's name, database name, user ID, and password:

    Here’s a refined version of the connection string you can try:

    Provider=MSOLEDBSQL; 
    Data Source=xxxxx.sql.azuresynapse.net; 
    Initial Catalog=MyDB; 
    Authentication=ActiveDirectoryPassword; 
    User  ID=XXXX; 
    Password=XXXX; 
    Encrypt=True; 
    TrustServerCertificate=False; 
    Connection Timeout=30;
    
    

    For more details, please refer: https://learn.microsoft.com/en-us/azure/synapse-analytics/sql-data-warehouse/sql-data-warehouse-connection-strings

    I hope this information helps. Please do let us know if you have any further queries.

    Thank you.


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.