Hacatalog example in java… private void testHCatalogAPI() throws NoSuchObjectException, TException, HCatException { HCatClient hcatClient = null; try { HiveConf hcatConf = new HiveConf(); hcatConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://vm-hadoop:9083"); hcatConf.set(HCatConstants.HCAT_HIVE_CLIENT_DISABLE_CACHE, "true"); hcatClient = HCatClient.create(new Configuration(hcatConf));
List<String> dbs = hcatClient.listDatabaseNamesByPattern("*"); for (String db: dbs) { List<String> tables = hcatClient.listTableNamesByPattern(db, "*"); for (String table: tables) { System.out.println("Table Name is: " + table); HCatTable tbl = hcatClient.getTable(db, table); System.out.println("Table Type is: " + tbl.getTabletype()); System.out.println("Table Props are: " + tbl.getTblProps()); List<HCatFieldSchema> fields = tbl.getCols(); for (HCatFieldSchema f: fields) { System.out.println("Field Name is: " + f.getName()); System.out.println("Field Type String is: " + f.getTypeString()); System.out.println("Field Type Category is: " + f.getTypeString()); if (f.getCategory().equals(HCatFieldSchema.Category.STRUCT)) { HCatSchema schema = f.getStructSubSchema(); List<String> structFields = schema.getFieldNames(); for (String fieldName: structFields) { System.out.println("Struct Field Name is: " + fieldName); } } } } } } finally { if (hcatClient != null) hcatClient.close(); System.out.println("END"); } } From: brajmohan saxena [mailto:braj.saxena...@gmail.com] Sent: Monday, April 4, 2016 8:57 PM To: d...@hive.apache.org Subject: Hive Metadata tables of a schema Hi, How can I access Hive metadata tables of a particular Server and Schema in a C program or through JDBC client. I have one application running on Client and my Hiveserver2 running on Remote machine. So if i provide Server name and Schema name in my client C program ,I should be able to get all the tables belongs that Schema. So Is there any Hive API where i can provide the Server and Schema name and get the tables of that schema. Thanks in advance, Regards Braj