if I log into my hive shell, do "show databases;" , I see many DBs:

Logging initialized using configuration in
file:/etc/hive/conf/hive-log4j.properties
hive> show databases;
OK
conf
confnew
default
money
testdb
Time taken: 1.57 seconds, Fetched: 6 row(s)


but somehow if I run the following java code using the client API, it only
shows "default"
 public static void main(String args[]) throws MetaException {
 HiveMetaStoreClient cli = new HiveMetaStoreClient(new HiveConf());
 for(String db: cli.getAllDatabases())
System.out.println(db);
 }


stence)
[2013-12-30 11:44:02,900] INFO Validating 2 unique key(s) for table DBS
(DataNucleus.Datastore.Schema)
[2013-12-30 11:44:02,913] INFO Validating 0 foreign key(s) for table DBS
(DataNucleus.Datastore.Schema)
[2013-12-30 11:44:02,919] INFO Validating 2 index(es) for table DBS
(DataNucleus.Datastore.Schema)
[2013-12-30 11:44:02,926] INFO Validating 1 unique key(s) for table
DATABASE_PARAMS (DataNucleus.Datastore.Schema)
[2013-12-30 11:44:02,937] INFO Validating 1 foreign key(s) for table
DATABASE_PARAMS (DataNucleus.Datastore.Schema)
[2013-12-30 11:44:02,942] INFO Validating 2 index(es) for table
DATABASE_PARAMS (DataNucleus.Datastore.Schema)
[2013-12-30 11:44:03,087] INFO Listener found initialisation for
persistable class org.apache.hadoop.hive.metastore.model.MDatabase
(DataNucleus.MetaData)
[2013-12-30 11:44:03,211] INFO 0: get_all_databases
(org.apache.hadoop.hive.metastore.HiveMetaStore)
[2013-12-30 11:44:03,261] INFO ugi=myuser_name  ip=unknown-ip-addr
cmd=get_all_databases (org.apache.hadoop.hive.metastore.HiveMetaStore.audit)
default






why is it showing only 1 db? what setttings of default are different from
the others to enable it to be shown?  also I wonder how is that HiveConf()
initialized ? how does it even know the hive port and config settings ? is
it hardcoded to /etc/hive/conf/hive-site.xml ?


thanks
Yang

Reply via email to