Database Backup (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 consists of related classes of all DBS features. You can use the latest versions of the two kits in the current Maven repository.

Maven configuration


Client initialization

// Use the profile to declare the AccessKey ID, AccessKey secret, and the region of the DBS backup schedule.
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, to call the CreateBackupPlan operation, you must set the Region, DatabaseType, InstanceClass, BackupMethod, Period, and UsedTime parameters.
Receive the response to the request by using the client.
CreateBackupPlanResponse response = client.getAcsResponse(req);
// Call the GET method in the response to retrieve the returned parameter values, such as the backup schedule ID.
String backupPlanId=response.getBackupPlanId();