The method for creating an ApsaraDB RDS for SQL Server schema and table is different from that for creating an ApsaraDB RDS for MySQL schema and table. This topic describes how to read data from and write data to an ApsaraDB RDS for SQL Server database.

Step 1: Create an ApsaraDB RDS for SQL Server schema

  1. Log on to the DLA console.

  2. In the left-side navigation pane, choose Serverless Presto > SQL access point. On the SQL access point page, find your virtual private cloud (VPC) and click Log on in DMS in the Actions column. Then, execute the following statement to create an ApsaraDB RDS for SQL Server schema.

    You can also connect to DLA by using the MySQL client or program code. Then, execute the following statement to create an ApsaraDB RDS for SQL Server schema:

    CREATE SCHEMA `hello_sqlserver_vpc_rds` WITH DBPROPERTIES 
     ( 
     CATALOG = 'sqlserver', 
     LOCATION = 'jdbc:sqlserver://rm-bp*****fake.sqlserver.rds.aliyuncs.com:3433;DatabaseName=rds_sqlserver_dbname',
     USER='rds_sqlserver_username',
     PASSWORD='rds_sqlserver_password',
     INSTANCE_ID = 'rds_sqlserver_instance_id',
     VPC_ID = 'rds_sqlserver_vpcid'
     );​
    Parameter Description
    CATALOG The type of the schema that you want to create. The value sqlserver indicates that an ApsaraDB RDS for SQL Server schema is to be created.
    LOCATION The JDBC URL of the ApsaraDB RDS for SQL Server database. The URL is in the format of jdbc:sqlserver://Endpoint of the ApsaraDB RDS for SQL Server database:3433/;DatabaseName=rds_sqlserver_dbname.
    USER The username that is used to log on to the ApsaraDB RDS for SQL Server database.
    PASSWORD The password of the username.
    INSTANCE_ID The ID of the ApsaraDB RDS for SQL Server instance.
    VPC_ID The ID of the VPC to which the ApsaraDB RDS for SQL Server instance belongs.

Step 2. Create a table

To create an ApsaraDB RDS for SQL Server table, you must specify the names of the schema and table in table_mapping.

​CREATE SCHEMA `hello_sqlserver_vpc_rds` WITH DBPROPERTIES 
 ( 
 CATALOG = 'sqlserver', 
 LOCATION = 'jdbc:sqlserver://rm-bp*****fake.sqlserver.rds.aliyuncs.com:3433;DatabaseName=rds_sqlserver_dbname',
 USER='rds_sqlserver_username',
 PASSWORD='rds_sqlserver_password',
 INSTANCE_ID = 'rds_sqlserver_instance_id',
 VPC_ID = 'rds_sqlserver_vpcid'
 );​

After you create the table, you can connect to DLA by using a client or program code and read data from the ApsaraDB RDS for SQL Server database. You can also cleanse data in Object Storage Service (OSS) or Tablestore and write the data to the ApsaraDB RDS for SQL Server database.