A network-related or instance-specific error occurred while establishing a connection to SQL Server
This topic describes solutions to use when you cannot access an ApsaraDB RDS for SQL Server instance from an ECS instance over an internal network or from other devices over the internet.
Problem description
When you use an ECS instance to connect to an ApsaraDB RDS for SQL Server instance over an internal network, the following error message appears.
Cannot connect to XXX.
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: TCP Provider, error: 0 - 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.) (Microsoft SQL Server, Error: 10060 or 258)Solutions
Note:
If you perform risky operations, such as modifying an instance or its data, ensure that the instance has disaster recovery and fault tolerance capabilities to protect your data.
Before you modify the configurations or data of instances, such as ECS and ApsaraDB RDS instances, create snapshots or enable features such as log backup.
If you have granted permissions or submitted security information, such as logon credentials, on the Alibaba Cloud platform, change them promptly.
An ECS instance cannot access an ApsaraDB RDS instance over an internal network
Check if the internal IP address of the ECS instance is added to the whitelist of the ApsaraDB RDS instance.
Before connecting to an ApsaraDB RDS instance using its internal endpoint, add the internal IP address of the ECS instance to the RDS whitelist. For more information, see How to query the IP address of an ECS instance and How to configure an RDS whitelist.
NoteIf you only add the public IP address of the ECS instance to the RDS whitelist, you cannot connect to the ApsaraDB RDS instance over the internal network.
Check if the ECS instance and the ApsaraDB RDS instance are in different regions.
An ECS instance and an ApsaraDB RDS instance must be in the same region to connect over the internal network. They can be in the same or different zones within the same region.
If the ECS instance and the ApsaraDB RDS instance are in different regions, they cannot connect directly over the internal network. You can use one of the following methods:
Method 1:
Release or request a refund for the ECS instance, and then purchase a new instance in the same region as the ApsaraDB RDS instance.
Release or request a refund for the ApsaraDB RDS instance, and then purchase a new instance in the same region as the ECS instance.
Method 2:
Use the public endpoint of the ApsaraDB RDS instance to connect from the ECS instance. This method provides lower performance, security, and stability. For more information, see Request a public endpoint for an ApsaraDB RDS for SQL Server instance.
Method 3:
Use Cloud Enterprise Network (CEN) to connect VPCs across regions. This method requires that both the source and destination instances use the VPC network type. For more information, see CEN overview.
Check if the ECS and ApsaraDB RDS instances have the same network type. Both must be either virtual private cloud (VPC) or classic network.
If the network types are different, use one of the following methods:
ImportantThe classic network type for Alibaba Cloud products is being phased out. For ApsaraDB RDS and ECS instances, switch from classic network to VPC as soon as possible. For more information, see [Product/Feature Change] Phasing out the classic network for ApsaraDB RDS databases and [Deprecation Notice] Discontinuation of services for classic network-type ECS instances.
Scenario: The ECS instance is in a VPC and the ApsaraDB RDS instance is in a classic network
Method 1 (Recommended): Switch the network type of the ApsaraDB RDS instance from classic network to the VPC of the ECS instance. For more information, see Change the network type.
Method 2: Use the public endpoint of the ApsaraDB RDS instance to connect from the ECS instance. This method provides lower performance, security, and stability. For more information, see Request a public endpoint for an ApsaraDB RDS for SQL Server instance.
Scenario: The ECS instance is in a classic network and the ApsaraDB RDS instance is in a VPC
Method 1 (Recommended): Migrate the ECS instance from the classic network to the VPC where the ApsaraDB RDS instance is located. On the details page of the ApsaraDB RDS instance, click View Connection Details next to Network Type to find the VPC ID. For more information, see Migrate an ECS instance from the classic network to a VPC.
Method 2: Enable the ClassicLink feature to allow the classic network-type ECS instance to connect to the ApsaraDB RDS instance in the VPC over the internal network.
NoteIf the network connection fails after you enable ClassicLink, see Troubleshoot connection failures between a classic network and a VPC after a ClassicLink connection is established.
Method 3: Use the public endpoint of the ApsaraDB RDS instance to connect from the ECS instance. This method provides lower performance, security, and stability. For more information, see Request a public endpoint for an ApsaraDB RDS for SQL Server instance.
If both the ECS and ApsaraDB RDS instances are in VPCs, check if they are in different VPCs.
If they are in different VPCs, use one of the following methods:
Method 1 (Recommended): Change the VPC of the ECS instance to the VPC where the ApsaraDB RDS instance is located. For more information, see Change the VPC of an ECS instance.
Method 2: Switch the VPC of the ApsaraDB RDS instance to the VPC where the ECS instance is located. For more information, see Switch between VPCs and vSwitches.
Method 3: Establish a Cloud Enterprise Network connection between the two VPCs.
Method 4: Use the public endpoint of the ApsaraDB RDS instance to connect from the ECS instance. This method provides lower performance, security, and stability. For more information, see Request a public endpoint for an ApsaraDB RDS for SQL Server instance.
Check if the whitelist is set to
0.0.0.0. The correct format is0.0.0.0/0.ImportantThe entry
0.0.0.0/0allows access from any IP address. This poses a security risk. Use it with caution.Check if the internal endpoint and port of the ApsaraDB RDS instance are correctly configured on the ECS instance. For more information, see View the internal and public endpoints and ports.
A device other than an ECS instance cannot access an ApsaraDB RDS instance
When you access an ApsaraDB RDS instance, use its internal same-region endpoint instead of its IP address. The IP address may change if the instance is migrated.
Devices other than ECS instances can only connect to an ApsaraDB RDS instance over the internet. If the connection fails, use the following methods to resolve the issue.
Check if you are using the internal endpoint of the ApsaraDB RDS instance.
You must change the endpoint to the public endpoint of the ApsaraDB RDS instance. To obtain the public endpoint, see View the public endpoint.
NoteDevices other than ECS instances and DMS cannot access an ApsaraDB RDS instance over the internal network, unless you use an Express Connect circuit.
Check if an RDS whitelist is configured. If not, see Configure a whitelist.
Check if the whitelist is set to
0.0.0.0. The correct format is0.0.0.0/0.ImportantThe entry
0.0.0.0/0allows access from any IP address. This poses a security risk. Use it with caution.If you have configured a whitelist but the connection still fails, the public IP address of your device that you added to the whitelist may not be the actual egress IP address. This can happen for the following reasons:
The public IP address is not fixed and may change.
The public IP address returned by an IP address query tool or website is inaccurate.
NoteTo confirm the public IP address of your device, see How to determine the public IP address of an external server or client for SQL Server.
Applicable to
ApsaraDB RDS for SQL Server





