This topic describes how to install and use RDS SDK for Java. RDS SDK for Java allows you to access your ApsaraDB for RDS instance without the need of complex programming.


Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to search for API operations, call API operations, and dynamically generate SDK sample code.


  • An AccessKey pair is created. For more information, see Create an AccessKey.
    Note We recommend that you create a RAM user and grant the RAM user the permissions to access ApsaraDB for RDS instances. Then, you can use the AccessKey pair of the RAM user to call RDS SDK for Java. This allows you to protect the AccessKey pair of your Alibaba Cloud account. For more information, see Implement access control by using RAM.
  • Java is installed. RDS SDK for Java requires JDK 1.6 or later.

Install RDS SDK for Java

  1. Visit the Java SDK page at GitHub.
  2. Download the RDS SDK for Java package and install the SDK by following the instructions provided in the README file.


  1. Configure the following parameters:
    IClientProfile profile
                 = DefaultProfile.getProfile(
            "regionId",    //The ID of the region where your RDS instance resides.
            "accessKeyId",    //The AccessKey ID of your RAM user.
            "accessKeySecret"    //The AccessKey secret of your RAM user.
  2. Configure the endpoint that is used to connect to your RDS instance.
            "endpointName",    //The name of the endpoint.
            "regionId",    //The ID of the region where your RDS instance resides.
            "product(Rds)",    //The product code for ApsaraDB for RDS. Enter Rds.
            "domain(endpoint)"    //The endpoint.
    Note For more information, see Request structure.
  3. Configure the parameters that are used to initialize the request.

    For example, configure the following parameters to initialize the request that is used to call the DescribeDBInstanceAttribute operation:

    DescribeDBInstanceAttributeRequest request = new  DescribeDBInstanceAttributeRequest();
  4. Initialize the AcsClient.
    IAcsClient client = new DefaultAcsClient(profile);
  5. View the response.
    DescribeDBInstanceAttributeResponse response =client.getAcsResponse(request);


Sample request:

IClientProfile profile
                = DefaultProfile.getProfile("cn-hangzhou","Akxxxxx",
                "ap-southeast-5", "Rds", "");
        DescribeDBInstanceAttributeRequest request = new DescribeDBInstanceAttributeRequest();
        IAcsClient client = new DefaultAcsClient(profile);
        try {
            DescribeDBInstanceAttributeResponse response = client.getAcsResponse(request);
        }catch (ServerException e) {

        } catch (ClientException e) {

Sample response: