Amazon DynamoDB
开发人员指南 (API 版本 2012-08-10)
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

步骤 5:(可选)删除表

删除 Movies 表:

  1. 将以下程序复制并粘贴到您的 Java 开发环境中:

    // Copyright 2012-2015, Inc. or its affiliates. All Rights Reserved. // Licensed under the Apache License, Version 2.0. package com.amazonaws.codesamples.gsg; import com.amazonaws.client.builder.AwsClientBuilder; import; import; import; import; public class MoviesDeleteTable { public static void main(String[] args) throws Exception { AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard() .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("http://localhost:8000", "us-west-2")) .build(); DynamoDB dynamoDB = new DynamoDB(client); Table table = dynamoDB.getTable("Movies"); try { System.out.println("Attempting to delete table; please wait..."); table.delete(); table.waitForDelete(); System.out.print("Success."); } catch (Exception e) { System.err.println("Unable to delete table: "); System.err.println(e.getMessage()); } } }
  2. 编译并运行程序。