gpt4 book ai didi

android - 关于 Amazon SimpleDB,选择函数

转载 作者:行者123 更新时间:2023-11-29 00:42:28 25 4
gpt4 key购买 nike

我使用这些代码来连接 SimpleDB 和查询数据。我可以在 SQL Scrap Book 中运行查询,结果正常。但是当我在 Eclipse 中运行它时,我收到错误消息:

"12-18 22:01:57.401: I/com.amazonaws.request(402): Received error response: Status Code: 400, AWS Request ID: d68b7fcc-cd4a-7def-602c-96ad189d8fcf, AWS Error Code: NoSuchDomain, AWS Error Message: The specified domain does not exist."

你知道吗?

//1. Creating a SimpleDB Client
AWSCredentials credentials = new BasicAWSCredentials( ACCESS_KEY_ID, SECRET_KEY );
AmazonSimpleDBClient sdbClient = new AmazonSimpleDBClient( credentials);

//2. Select
String nextToken = null;
SelectRequest selectRequest = new SelectRequest( "select * from mydomain" ).withConsistentRead( true );
selectRequest.setNextToken( nextToken );
SelectResult response = sdbClient.select( selectRequest );
nextToken = response.getNextToken();

最佳答案

在请求域数据之前,您需要指定服务器区域端点。 Amazon Simple DB 支持 7 个区域端点。

区域、端点

"US-East(Northern Virginia)", "sdb.amazonaws.com"
"EU(Ireland)", "sdb.eu-west-1.amazonaws.com"
"US-West(Northern California)", "sdb.us-west-1.amazonaws.com"
"Asia Pacific(Singapore)", "sdb.ap-southeast-1.amazonaws.com"
"Asia Pacific(Tokyo)", "sdb.ap-northeast-1.amazonaws.com"
"US West(Oregon)", "sdb.us-west-2.amazonaws.com"
"South America(Sao Paulo)", "sdb.sa-east-1.amazonaws.com"

如何设置区域终点

BasicAWSCredentials basicAWSCredentials = new BasicAWSCredentials(sAccessKey, sSecretKey);
AmazonSimpleDBClient amazonSimpleDBClient = new AmazonSimpleDBClient(basicAWSCredentials);
amazonSimpleDBClient.setEndpoint(Endpoint);

关于android - 关于 Amazon SimpleDB,选择函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8552332/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com