After you complete the initial configuration for an ApsaraDB RDS for SQL Server instance, you can connect to the RDS instance by using various methods such as Data Management (DMS) and Microsoft SQL Server Management Studio (SSMS) to perform the required operations. This topic describes how to connect to an RDS instance by using these connection methods.
Prerequisites
An RDS instance is created. For more information, see Create an ApsaraDB RDS for SQL Server instance.
A database is created in the RDS instance, and an account is created for the database. For more information, see Create accounts and databases.
An IP address whitelist is configured for the RDS instance. This way, you can connect to the RDS instance from the Elastic Compute Service (ECS) instance on which a client is deployed or from an on-premises device. For more information, see Configure an IP address whitelist for an ApsaraDB RDS for SQL Server instance.
NoteIf you want to connect an ECS instance to the RDS instance over an internal network, make sure that these instances reside in the same virtual private cloud (VPC), and the private IP address of the ECS instance is added to an IP address whitelist of the RDS instance.
If you want to connect an on-premises device to the RDS instance, make sure that the public IP address of the on-premises device is added to an IP address whitelist of the RDS instance.
Procedure
You can use DMS or a client to connect to the RDS instance.
Method 1: Use DMS to connect to the RDS instance
DMS is a one-stop data management platform that allows you to manage data throughout its lifecycle. You can use DMS to manage global data assets, govern data, design and develop databases, integrate data, develop data, and consume data. These features help enterprises obtain value from data in an efficient and secure manner and facilitate the digital transformation of enterprises. For more information, see What is DMS?
You can use DMS to log on to your RDS instance to manage and use data without the need to configure IP address whitelists or connection types for the RDS instance.
Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
On the page that appears, click Log On to Database.
In the Log on to Database Instance dialog box, enter the logon information and click Login.
Configure the Access Mode parameter. In this topic, Account + password login is selected.
Configure the Database Account and Database Password parameters. In this topic, a privileged account named
testuser
and a custom password are used.Configure the Control Mode parameter. In this topic, Flexible Management is selected.
NoteIf your RDS instance is managed in Flexible Management mode, you can use DMS to manage the instance free of charge. If your RDS instance is managed in Stable Change or Security Collaboration, fees are generated. For more information, see Pricing.
Compared with the Flexible Management mode, the Stable Change and Security Collaboration modes provide more features and enhanced database management capabilities. If your RDS instance is for trial use, we recommend that you select Flexible Management. For more information, see Control modes.
View the database. In the left-side navigation pane of the DMS console, choose Database Instances > Instances Connected to view the database that you create. In this topic, the database named
dbtest
is displayed. You can also double-click a database.NoteIf the RDS instance exists but the required database is not displayed on the Instance Connected page of the DMS console, troubleshoot the issue based on the following information:
The logon account does not have the permissions to connect to the required database. In this case, you can go to the Accounts page of the RDS instance, find the logon account, and then click Change Permissions in the Actions column to grant the required permissions. For more information, see Modify the permissions of an account.
The metadata of the required database is not synchronized. In this case, move the pointer over the RDS instance to which the required database belongs and click the icon to the right of the instance name. Then, you can find the required database.
Method 2: Use the SSMS client to connect to the RDS instance
Microsoft SQL Server Management Studio (SSMS) client is a GUI tool that enables you to manage and handle SQL Server databases. SSMS can be used to connect to different SQL Server databases such as RDS instances, on-premises SQL Server instances, and instances that run SQL Server in other clouds. For more information, see Download SQL Server Management Studio (SSMS).
This section provides an example on how to use SSMS 19.0
to connect to an RDS instance.
We recommend that you download the latest version of SSMS to support all SQL Server versions.
If you want to use a client to connect to an RDS instance, you must configure an IP address whitelist for the RDS instance and obtain the endpoint of the RDS instance based on your business requirements.
Start the SSMS 19.0 client.
Choose Connect > Database Engine.
In the Connect to Server dialog box, configure the parameters that are required for the logon.
Parameter
Example value
Description
Server name
rm-2ze****.rds.aliyuncs.com,1433
The endpoint and port number of the RDS instance. Enter the public endpoint and public port number obtained when you apply for the public endpoint. Separate the endpoint and port number with a comma (,).
Authentication
SQL Server Authentication
The authentication mode of SQL Server.
Username
testuser
The username of the account for the RDS instance.
Password
Test_pw123
The password of the account for the RDS instance.
Click Connect.
After the connection is successful, the connection information is displayed on the left side of SSMS.
FAQ
How do I use Function Compute to obtain data from my RDS instance?
You can install third-party dependencies on Function Compute. Then, you can obtain data from your RDS instance by using the built-in modules that are provided by the third-party dependencies in Function Compute. For more information, see Install third-party dependencies for a function.