JDBC is not required here.
Create a hive SQLContext as below , this works for me
val conf = new org.apache.spark.SparkConf().setAppName("hive app")
val sc = new org.apache.spark.SparkContext(conf)
val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc)
val df1 = sqlContext.sql(s"use $dbname");
val dfUnion1 = sqlContext.sql(s"Select * from table_name");