Changes between Version 1 and Version 2 of waue/2010/0204-05


Ignore:
Timestamp:
Feb 3, 2010, 9:52:34 PM (14 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • waue/2010/0204-05

    v1 v2  
    44{{{
    55#!java
     6package tsmc;
     7
     8import java.io.IOException;
     9
     10import org.apache.hadoop.hbase.HBaseConfiguration;
     11import org.apache.hadoop.hbase.client.HBaseAdmin;
     12
     13public class DropTable {
     14
     15        static void drop(String tablename) {
     16                HBaseConfiguration conf = new HBaseConfiguration();
     17                HBaseAdmin admin;
     18                try {
     19                        admin = new HBaseAdmin(conf);
     20                        if (admin.tableExists(tablename))
     21                        {
     22                                admin.disableTable(tablename);
     23                                admin.deleteTable(tablename);
     24                                System.out.println("Droped the table [" + tablename+ "]");
     25                        }else{
     26                                System.out.println("Table [" + tablename+ "] was not found!");
     27                        }
     28                       
     29                } catch (IOException e) {
     30                        e.printStackTrace();
     31                }
     32        }
     33        public static void main(String[] argv) {
     34                drop("testtable");
     35        }
     36}
    637
    738}}}