Introduction to SDK Demo

Last Updated: Dec 22, 2017

This section introduces how to run the demo code provided on the DTS console.

Create an AccessKey

When an SDK connects the subscription instance, it has to pass the AccessKey certification of an Alibaba Cloud account. Therefore, you must create an AccessKey before using the SDK. If your Alibaba Cloud account already has an AccessKey, you can skip this step. Otherwise, do the following:

  1. Log on to the Alibaba Cloud console.

  2. Hover the mouse over your account name in the upper right corner, and then click accesskeys.

  3. Click Create AccessKey in the upper right corner to create an AccessKey.

Install JAVA SDK

The development environment compatible with DTS Java SDK is J2SE Development Kit (JDK) 1.5 or later.

In an Eclipse project, you can install the Java SDK through the following steps:

  1. Download the SDK package consumer.jar from SDK Download.

  2. Import the jar package. In Eclipse, right click on the blank area and select Project > Properties > Java Build Path > Libraries > Add External JARs.

  3. Select the save path of the downloaded consumer.jar, then click OK.

Run sample code

DTS provides a demo for DTS SDK. You can replicate the demo code from View Demo Code in the DTS console.

In an Eclipse project, you can run the demo code through the following steps.

  1. Create a MainClass class under the src directory of the Eclipse project.

  2. Open the generated Java file MainClass, and then delete the code template inside.

  3. Paste the sample code in the MainClass file.

  4. Modify AccessKeyID, AccessKeySecret, and subscription instance ID in the sample code.

    SDK Demo

    The subscription instance ID is obtained in the DTS console.

    GUID

    Change the marked sections in the preceding demo to your own Alibaba Cloud account AccessKeyID, AccessKeySecret, and subscription instance ID.

  5. In Eclipse, right click the demo file, and then select Operation Mode > Java Application to run the demo.

Thank you! We've received your feedback.