All Products
Document Center

Use the DBS Java SDK through Maven dependencies

Last Updated: Mar 24, 2020

The DBS SDK for Java includes two core kits: aliyun-java-sdk-core and aliyun-java-sdk-dbs. The aliyun-java-sdk-core kit automatically routes requests to the DBS endpoint. The aliyun-java-sdk-dbs kit includes the related classes of all DBS features. You can use the latest versions in the current Maven repository as the versions of these two kits.

Maven configuration


Client initialization

// Use the profile to declare the AccessKey ID, AccessKey secret, and the region of the DBS instance.
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", "accsessKeyId", "accessSecret");
// Use the profile to initialize a client object.
IAcsClient client = new DefaultAcsClient(profile);

Example of calling the CreateBackupPlan operation

// Declare a request object.
CreateBackupPlanRequest req = new CreateBackupPlanRequest();
// Set the request parameters. For example, set the Region, DatabaseType,
// InstanceClass, BackupMethod, Period, and UsedTime parameters for calling the CreateBackupPlan operation.
// Receive the response to the request through the client.
CreateBackupPlanResponse response = client.getAcsResponse(req);
// Call the GET method in the response to retrieve the returned parameter values, for example, the backup schedule ID.
String backupPlanId=response.getBackupPlanId();