java应用程序访问amazon simpledb域名

时间:2014-05-20 06:26:49

标签: amazon-simpledb

我需要在java中创建一个能够访问simpledb中的域的应用程序。我创建了帐户并生成了访问密钥。工具 - sdb资源管理器,暂存器和Firefox的sdb工具无法正常工作。我应该怎么开始。

1 个答案:

答案 0 :(得分:0)

您需要指定region and endpoint所属的正确domainAmazon SimpleDB支持8个区域端点。

这是链接: http://docs.aws.amazon.com/general/latest/gr/rande.html#sdb_region

以下是示例代码:

AmazonSimpleDBConfig theConfig = new AmazonSimpleDBConfig();
theConfig.ServiceURL = myEndpoint;  //where myEndPoint is the region endpoint you are interested in
AmazonSimpleDBClient simpleDbClient= new AmazonSimpleDBClient(myKey, mySecretKey, theConfig);
String selectExpression = "select * from LogTable";
SelectRequest selectRequestAction = new SelectRequest();
selectRequestAction.SelectExpression = selectExpression;
selectRequestAction.NextToken = null;
SelectResponse selectResponse = simpleDbClient.Select(selectRequestAction);
SelectResult selectResult = selectResponse.SelectResult;
List<Item> itemList = selectResult.Item;

同样适用于您的third party tool。如果您使用的是 SDB Explorer ,则在成功登录后,您应该会看到左侧角落的区域和端点列表。您应该探索可以找到创建的domain的正确区域终点。