This document describes how to connect to a TencentDB for SQL Server instance through SQL Server Management Studio (SSMS), and run a simple query.
Connection scenarios
The connection methods vary by TencentDB instance type:
You can connect to a two-node TencentDB for SQL Server instance (formerly high-availability edition/cluster editions) from a local system in the following three methods:
You can connect to a single-node TencentDB for SQL Server instance (formerly basic edition) from a local system in the following three methods:
The following are connection options:
Enabling the public network address in the console and connecting to the TencentDB for SQL Server instance from a local system through SSMS.
Binding the TencentDB for SQL Server instance to CLB and connecting to the instance from a local system through SSMS.
Using a Linux CVM instance with a public IP to map the ports and connecting to the instance from a local system through SSMS
Enabling the public network address in the console and connecting to the TencentDB for SQL Server instance from a local system through SSMS
Step 1. Enable the public network address
2. Select the region and click the ID or Manage in the Operation column of the target instance in the instance list.
3. In the Instance Info on the Instance Details page, click Enable next to the Public Network Address.
4. In the Enabling public network window, read the note, indicate your consent, and click OK.
5. After public network access is enabled, view the public IP address and port number of the instance in Basic Info on the Instance Details tab.
Step 2. Connect to the TencentDB for SQL Server instance over the public network
2. Start SSMS locally. On the Connect to server page, enter the relevant information to connect to TencentDB. Click Connect and wait a few minutes before SSMS connects to your database instance.
Server type: Select Database Engine.
Server name: Enter the public IP address and port number of the instance and separate them by comma.
Authentication: Select SQL Server Authentication.
Login and Password: Enter the account name and password you configured when creating the instance account on the Account Management page.
3. Once connected to the database, you can view the standard built-in system databases (master, model, msdb and tempdb) of SQL Server.
4. Now you can start creating your own databases and running queries for them. Select File > New > Query with Current Connection and type the following SQL query:
Run the query. SSMS returns the TencentDB for SQL Server instance.
Binding the TencentDB for SQL Server instance to CLB to enable public network access and connecting to the instance from a local system through SSMS
Step 1. Purchase a CLB instance
Note:
If you already have a CLB instance in the same region as TencentDB for SQL Server, skip this step.
Note:
Region: You need to select the region where the TencentDB for SQL Server instance is.
Network: You can select the same VPC as the instance or a different one.
1. Enable cross-VPC access (you can skip this step if the CLB instance and TencentDB for SQL Server instance are in the same VPC)
a. Log in to the CLB Console, select the region, and click the instance ID in the instance list to enter the management page.
b. On the Basic information page, click Configure in the Backend server section.
c. In the pop-up window, click Submit. 2. Configure a public network listener port
a. Log in to the CLB Console, select the region, and click the instance ID in the instance list to enter the management page.
b. On the instance management page, select the Listener management tab and click Create below TCP/UDP/TCP SSL/QUIC listener. c. In the pop-up window, complete the settings and click Submit.
Step 3. Bind a TencentDB for SQL Server instance
1. After creating the listener, click it in Listener management and click Bind on the right.
2. In the pop-up window, select Other Private IPs as the object type, enter the IP address and port of the TencentDB for SQL Server instance, and click OK.
Note:
The login account must be a standard account (bill-by-IP). If binding fails, submit a ticket for assistance. 1. Log in to the TencentDB for SQL Server console. Select a region, click an instance ID in the instance list or Manage in the Operation column to access the instance management page. 2. On the instance management page, select the Security Group tab, click Configure Security Group, configure the security group rule to open all ports, and confirm that the security group allows access from public IPs. For more information on configuration, see Configuring Security Group. Step 5. Connect to the TencentDB for SQL Server instance over the public network
2. Start SSMS locally. On the Connect to server page, enter the relevant information to connect to TencentDB. Click Connect and wait a few minutes before SSMS connects to your database instance.
Server type: Select Database Engine.
Server name: Enter the local IP address and port number of the CLB instance and separate them by a comma, such as 10.0.0.1,4000
.
Authentication: Select SQL Server Authentication.
Login and Password: Enter the account name and password you configured when creating the instance account on the Account Management page.
3. Once connected to the database, you can view the standard built-in system databases (master, model, msdb and tempdb) of SQL Server.
4. Now you can start creating your own databases and running queries for them. Select File > New > Query with Current Connection and type the following SQL query:
Run the query. SSMS returns the TencentDB for SQL Server instance.
Using a linux CVM instance with a public IP to map the ports and connecting to the instance from a local system through SSMS
Note:
The CVM and TencentDB instances must be under the same account and in the same VPC in the same region.
For data security considerations, TencentDB for SQL Server doesn't support public IP. If you need to use a public IP, you can use the port mapping feature of SSH2 to connect to, configure, and manage an instance from the internet.
1. Log in to the TencentDB for SQL Server console. View the private IP and port number of the instance on the Instance Details page. The private IP and port number will be used for port mapping configuration. 4. Select Options > Session Options in the SecureCRT menu bar to enter the session properties settings.
5. On the session properties settings page, select Connection > Port Forwarding > Add to enter the port mapping configuration page.
6. On the port mapping configuration page, configure the corresponding parameters.
8. Start SSMS locally. On the Connect to server page, enter the relevant information to connect to TencentDB. Click Connect and wait a few minutes before SSMS connects to your database instance.
Server type: Select Database Engine.
Server name: enter the local IP address and port number and separate them with a comma, such as 10.0.0.1,4000
. The port number should be the same as that configured in step 6.
Authentication: Select SQL Server Authentication.
Login and Password: Enter the account name and password you configured when creating the instance account on the Account Management page.
9. Once connected to the database, you can view the standard built-in system databases (master, model, msdb and tempdb) of SQL Server.
10. Now you can start creating your own databases and running queries for them. Select File > New > Query with Current Connection and type the following SQL query:
Run the query. SSMS returns the TencentDB for SQL Server instance.
Was this page helpful?