I use these codes to connect SimpleDB and query data. I can run the query in SQL Scrap Book, and the result is OK. But when I run it in Eclipse, I got error message:
"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."
Do you have any idea of that?
//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();
you need to specify server region end point before requesting data for domain. Amazon Simple DB supports 7 region ends points.
Region, Endpoint
"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"
How to set region end point
BasicAWSCredentials basicAWSCredentials = new BasicAWSCredentials(sAccessKey, sSecretKey);
AmazonSimpleDBClient amazonSimpleDBClient = new AmazonSimpleDBClient(basicAWSCredentials);
amazonSimpleDBClient.setEndpoint(Endpoint);