wiki:waue/2010/0204-05
close Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": /usr/lib/python2.7/dist-packages/libsvn/_core.so: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.

Version 2 (modified by waue, 15 years ago) (diff)

--

範例五: 刪除資料表

package tsmc;

import java.io.IOException;

import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HBaseAdmin;

public class DropTable {

  static void drop(String tablename) {
    HBaseConfiguration conf = new HBaseConfiguration();
    HBaseAdmin admin;
    try {
      admin = new HBaseAdmin(conf);
      if (admin.tableExists(tablename))
      {
        admin.disableTable(tablename);
        admin.deleteTable(tablename);
        System.out.println("Droped the table [" + tablename+ "]");
      }else{
        System.out.println("Table [" + tablename+ "] was not found!");
      }
      
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  public static void main(String[] argv) {
    drop("testtable");
  }
}