In all probability there is no user database created in Hive Create a database yourself
sql("create if not exists database test") It would be helpful if you grasp some concept of Hive databases etc? HTH Dr Mich Talebzadeh LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw <https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>* http://talebzadehmich.wordpress.com On 14 June 2016 at 15:40, Sree Eedupuganti <s...@inndata.in> wrote: > Hi Spark users, i am new to spark. I am trying to connect hive using > SparkJavaContext. Unable to connect to the database. By executing the below > code i can see only "default" database. Can anyone help me out. What i need > is a sample program for Querying Hive results using SparkJavaContext. Need > to pass any values like this. > > userDF.registerTempTable("userRecordsTemp") > > sqlContext.sql("SET hive.default.fileformat=Orc ") > sqlContext.sql("set hive.enforce.bucketing = true; ") > sqlContext.sql("set hive.enforce.sorting = true; ") > > public static void main(String[] args ) throws Exception { > SparkConf sparkConf = new > SparkConf().setAppName("SparkSQL").setMaster("local"); > SparkContext ctx=new SparkContext(sparkConf); > HiveContext hiveql=new > org.apache.spark.sql.hive.HiveContext(ctx); > DataFrame df=hiveql.sql("show databases"); > df.show(); > } > > Any suggestions please....Thanks. >