cannot connect azure sql database to vs code

John 0 Reputation points
2024-06-19T01:40:39.7433333+00:00

Testing connection profile...

mssql: Error: Unable to connect using the connection information provided. Retry profile creation?

mssql: Error -1: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)I would like to query and insert data into my azure sql database directly from vs code, and not with SSMS. However i am getting the above error msgs. Any advice?

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. ShaktiSingh-MSFT 14,201 Reputation points Microsoft Employee
    2024-06-19T12:46:01.43+00:00

    Hi John •,

    Welcome to Microsoft Q&A forum.

    As I understand, you could not connect to Azure SQL Database from VS Code.

    As per the error message, please check server name like server\instancename.

    Make sure the server machine is reachable, example DNS can be resolve correctly, you are able to ping the server.

    Refer similar error post here for solution options:

    https://learn.microsoft.com/en-us/answers/questions/163193/provider-sql-network-interfaces-error-26-error-loc

    Could you please provide below information:

    What is Network/Firewall setting for the existing server in place?

    Please share sample code which you are using to establish connection.

    Let us know your finding.

    Thanks

    0 comments No comments