Search code examples
sql-servergoogle-compute-enginegoogle-cloud-sqlcloud-sql-proxy

Sqlcmd error while connecting with SQL Server instance on a VM using SQL Server proxy


I have created a private SQL Server instance and trying to access it on Virtual Machine instance using SQL Server proxy using the link (https://cloud.google.com/sql/docs/sqlserver/connect-instance-private-ip) on GCP platform

It worked well but today it was throwing the below 2 errors repeatedly while running the sqlcmd command

sqlcmd -S 127.0.0.1 -U sqlserver

Error:

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Timeout error [258].
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Unable to complete login process due to delay in prelogin response.

and

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2749.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections.

I am not sure how to resolve these issues.


Solution

  • The above issue might occur when the private service access connection breaks for the SQL server instance on GCP platform. That is when some one mistakenly removes the peering. The above error resolves when we create/update the existing peering connection. The solution is posted in the link Unable to recreate Private Service Access on GCP