This section introduces how to run the demo code provided on the DTS console.
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:
Log on to the Alibaba Cloud console.
Hover the mouse over your account name in the upper right corner, and then click accesskeys.
Click Create AccessKey in the upper right corner to create an AccessKey.
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:
Download the SDK package consumer.jar from SDK Download.
Import the jar package. In Eclipse, right click on the blank area and select Project > Properties > Java Build Path > Libraries > Add External JARs.
Select the save path of the downloaded consumer.jar, then click OK.
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.
Create a MainClass class under the src directory of the Eclipse project.
Open the generated Java file MainClass, and then delete the code template inside.
Paste the sample code in the MainClass file.
subscription instance IDin the sample code.
The subscription instance ID is obtained in the DTS console.
Change the marked sections in the preceding demo to your own Alibaba Cloud account AccessKeyID, AccessKeySecret, and subscription instance ID.
In Eclipse, right click the demo file, and then select Operation Mode > Java Application to run the demo.