You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Soni spark <so...@gmail.com> on 2015/12/23 16:24:40 UTC

Unable to create hive table using HiveContext

Hi friends,

I am trying to create hive table through spark with Java code in Eclipse
using below code.

HiveContext sqlContext = new org.apache.spark.sql.hive.HiveContext(sc.sc());
   sqlContext.sql("CREATE TABLE IF NOT EXISTS src (key INT, value STRING)");


but i am getting error

RROR XBM0J: Directory /home/workspace4/Test/metastore_db already exists.

I am not sure why metastore creating in workspace. Please help me.

Thanks
Soniya

Re: Unable to create hive table using HiveContext

Posted by Zhan Zhang <zz...@hortonworks.com>.
You are using embedded mode, which will create the db locally (in your case, maybe the db has been created, but you do not have right permission?).

To connect to remote metastore, hive-site.xml has to be correctly configured.

Thanks.

Zhan Zhang


On Dec 23, 2015, at 7:24 AM, Soni spark <so...@gmail.com>> wrote:

Hi friends,

I am trying to create hive table through spark with Java code in Eclipse using below code.

HiveContext sqlContext = new org.apache.spark.sql.hive.HiveContext(sc.sc<http://sc.sc/>());
   sqlContext.sql("CREATE TABLE IF NOT EXISTS src (key INT, value STRING)");


but i am getting error

RROR XBM0J: Directory /home/workspace4/Test/metastore_db already exists.

I am not sure why metastore creating in workspace. Please help me.

Thanks
Soniya