Try something like: HiveConf hiveConf; hiveConf=new HiveConf(); hiveConf.addResource("/etc/hive/conf/hive-default.xml"); HiveMetaStoreClient hiveClient; try { hiveClient = new HiveMetaStoreClient(hiveConf); // use the client; } catch (Exception exp) { exp.printStackTrace(); }
On Wed, Aug 26, 2015 at 8:07 PM, Jerrick Hoang <jerrickho...@gmail.com> wrote: > Thanks all, that was super quick and helpful! Can someone give me a quick > code example of how to create a HiveMetaStoreClient object from > configurations in hive-site.xml, or how would I create a > HiveMetaStoreClient object given the uri and the credentials to talk to the > thrift server? > > On Wed, Aug 26, 2015 at 10:20 AM, Alan Gates <alanfga...@gmail.com> wrote: > >> Yes, sorry, I wasn't clear. As others have stated, HiveMetaStoreClient >> uses the thrift API. So using that should be fine. >> >> Alan. >> >> Subroto Sanyal <ssan...@datameer.com> >> August 26, 2015 at 10:07 >> Hi Jerrick, >> HiveMetastoreClient will be using thrift communication internally via the >> connection. IMO It is no different from using thrift api. >> >> Cheers, >> Subroto Sanyal >> >> >> Jerrick Hoang <jerrickho...@gmail.com> >> August 26, 2015 at 9:44 >> Ok, I'm super confused now. The hive metastore is a RDBMS database. I >> totally agree that I shouldn't access it directly via jdbc. So what about >> using this class >> http://hive.apache.org/javadocs/r0.13.1/api/metastore/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.html >> ? Is it something that can only be used >> >> If not I can definitely use the thrift api. Just wanted to ask this >> before going the thrift route because this class seems like the perfect >> tool for me, >> >> Thanks >> >> >> >