hive - How to register a table for JDBC connection - Apache Spark -


i can't seem create table can read external applications in apache spark. i'm able load dataframe, start thrift server part of same context, register dataframe table, yet when connect thrift server there no table there.

any appreciated. i'm new spark. below commands entered in spark-shell. i'm using windows 10.

spark-shell --driver-class-path  c:\microsoftjdbc_sqlserver\sqljdbc_6_0\enu\jre8\sqljdbc42.jar val sqlcontext = new org.apache.spark.sql.sqlcontext(sc) val sql = new org.apache.spark.sql.hive.hivecontext(sc) val jdbcsqlconnstr = "jdbc:sqlserver://localhost:1433;instance=sqlexpress;databasename=wideworldimporters;user=spark;password=spark;" val jdbcdbtable = "sales.invoicelines" val jdbcdf = sqlcontext.read.format("jdbc").options(map("url" ->  jdbcsqlconnstr, "dbtable" -> jdbcdbtable)).load() jdbcdf.registertemptable("invoices") sql.setconf("hive.server2.thrift.port", "10001")  

org.apache.spark.sql.hive.thriftserver.hivethriftserver2.startwithcontext(sql)


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -