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 <soni2015.sp...@gmail.com<mailto:soni2015.sp...@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