2

Below are the steps which I follow while connecting manually:

  1. Connect to VPN
  2. RDP to the remote machine using my credentials
  3. Open SQL Server Management Studio
  4. Connect to Server > database engine, Server Name > "Name", Authentication > Windows Authentication
  5. Run query

And the connection string that I am using is:

ConnectionString = "Data Source =tcp:<IPAddress of RDP Machine>\<ServerName>;
Initial Catalog =<DBName>; User Id = <Username>; 
Password = <Password>; Trusted_Connection = True; 
Integrated Security = SSPI; Connect Timeout = 30; Encrypt = False; TrustServerCertificate = False"
  • So the manual query via SSMS works, right? What is using the connection string? It seems to miss a lot of data; is it anonymized? – vonPryz Aug 28 '18 at 7:04
2

In your manual procedure you state that you specify "name" in the server name, not an instance.

However in your connection string you specify

Data Source =tcp:<IPAddress of RDP Machine>\<ServerName>;

Which indicates <servername> should be used as an instance name.

You should probably remove \<servername> part of your connection string.

You should also verify the necessary ports are open on the firewall and make sure SQL Server is configured to allow remote connections as well as make sure tcp/ip is in the enabled protocols.

There is a decent MSDN blog post covering a lot of other steps you can take to troubleshoot your connectivity issues: Troubleshoot Connectivity/Login failures (18456 State x) with SQL Server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.