2011年12月26日

Select From Amazon SimpleDB

//1. Creating a SimpleDB Client

AWSCredentials credentials = new BasicAWSCredentials( ACCESS_KEY, SECRET_KEY );

AmazonSimpleDBClient sdbClient = new AmazonSimpleDBClient( credentials);

sdbClient.setEndpoint("sdb.us-west-1.amazonaws.com"); // to define Data Center Region

 

//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();

没有评论: