我正在尝试使用 Spark Scala 读取 MySQL 文件。以下是我尝试过的代码
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()
但我正在收集仓库路径错误,如下所示:
仓库路径是 'file:/C:/Users/Owner/eclipse-workspace/stProject/spark-warehouse/'。org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:72) 的 org.apache.spark.sql 中的线程“main”java.lang.NullPointerException 中的异常。 execution.datasources.jdbc.JDBCRelation.(JDBCRelation.scala:113) at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:45) at