Unable to connect to Azure SQL Server from local machine

Singh, Abhinav (External) 0 Reputation points
2024-11-12T12:18:09.66+00:00

I have created a SQL Server DB and added required firewall rules. However, I am unable to connect to the DB from my local machine using any SQL Editor. For e.g., DBeaver. Though, I can connect the DB using Azure's in-built "Query Editor".

I can telnet the DB server on port 1433 from my local machine.

telnet test-db-server.database.windows.net 1433

URL:

jdbc:sqlserver://test-db-server.database.windows.net:1433;database=testDB;user=testadmin@test-db-server;password=******;encrypt=true;trustServerCertificate=false;hostNameInCertificate=.database.windows.net;loginTimeout=30;

Error:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ClientConnectionId:06dfdee7-2bb5-4bbe-aa92-a7d33b429b5a

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Azure SQL Database
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 12,086 Reputation points
    2024-11-12T13:31:04.25+00:00

    Hello Singh, Abhinav (External),

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you are unable to connect to Azure SQL Server from local machine.

    This could happen due to many reasons starting from your local environment, and since you can connect using Azure's in-built Query Editor and telnet to the server, the issue might be related to the configuration of your SQL Editor or network settings.

    Therefore, check the following, you should be able to resolve this in no time:

    • Ensure that your local machine's IP address is added to the firewall rules in Azure SQL Database.
    • Double-check the connection string for any typos or incorrect parameters. Your connection string looks correct, but it's always good to verify.
    • Since you're using encrypt=true, make sure that your SQL Editor supports SSL/TLS connections. Sometimes, older versions of SQL Editors might not support the required encryption protocols.
    • If your SQL Server is behind a Network Security Group, ensure that the NSG rules allow outbound traffic on port 1433.
    • If you're behind a corporate proxy, ensure that your SQL Editor is configured to use the proxy settings.
    • In DBeaver, go to the connection settings and ensure that the driver properties are correctly set. Sometimes, additional properties like trustServerCertificate need to be explicitly set.
    • Increase the loginTimeout parameter in your connection string to see if the connection is just taking longer than expected.

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.


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.