1

I am trying to read MySQL file using Spark Scala. Following is the code I tried

val dataframe_mysql = sqlContext.read.format("jdbc")
 .option("url","jdbc:mysql://xx.xx.xx.xx:xx")
 .option("driver", "com.mysql.jdbc.Driver")
 .option("dbtable", "schema.xxxx")
 .option("user", "xxxx").option("password", "xxxxx").load()

but I am collecting Warehouse path error as following:

Warehouse path is 'file:/C:/Users/Owner/eclipse-workspace/stProject/spark-ware‌​house/'. Exception in thread "main" java.lang.NullPointerException at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.res‌​olveTable(JDBCRDD.sc‌​ala:72) at org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation‌​.(JDBCRelation‌​.scala:113) at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelation‌​Provider.createRelat‌​ion(JdbcRelationProv‌​ider.scala:45) at

zero323
  • 322,348
  • 103
  • 959
  • 935
  • What's the version of Spark? Do you `enableHiveSupport` while creating `sqlContext`? Do you need it? That looks like an issue with JDBC itself not a metastore. – Jacek Laskowski Jan 13 '18 at 19:27

0 Answers0