Exists a Table

Existence of Table using HBase Shell

You can verify the existence of a table using the exists command. The following example shows how to use this command.

hbase> exists 'emp'
Table emp does exist

0 row(s) in 0.0750 seconds

===================================
hbase(main):015:0> exists 'student'
Table student does not exist

0 row(s) in 0.0480 seconds
Verifying the Existence of Table Using Java API
import java.io.IOException;

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

/**
 * 
 * @author ashok.mariyala
 *
 */
public class TableExists{

   public static void main(String args[])throws IOException{

      // Instantiating configuration class
      Configuration conf = HBaseConfiguration.create();

      // Instantiating HBaseAdmin class
      HBaseAdmin admin = new HBaseAdmin(conf);

      // Verifying the existance of the table
      boolean bool = admin.tableExists("emp");
      System.out.println( bool);
   }
} 
Exists a Table
Scroll to top