【发布时间】:2018-12-27 18:47:27
【问题描述】:
我正在尝试将数据加载到 hive 中,同时将数据加载到 hive 表中我遇到错误“java.lang.RuntimeException:为 jdbc 找到多个源”任何帮助都会很明显。
val url1="jdbc:hive2://xxxxxx.google.com:10000/jkl_cak_coh_batch;principal=hive/xxxxxx.google.com@internal.lllglobal.com;mapred.job.queue.name=io9;AuthMech=3;SSL=1;" +
"SSLTrustStore=/usr/java/jdk1.8.0_144/jre/lib/security/oooacerts;user=xxxx;password=yyyyy"
val connectionProperties = new Properties()
connectionProperties.put("user", "xxxxxx")
connectionProperties.put("password", "xxxxxx")
sparkSession.sqlContext.sql("select * from " + tmpTable )
.write
.format("org.apache.spark.sql.execution.datasources.jdbc.DefaultSource")
.mode(SaveMode.Append) // <--- Append in existing table
.option("driver", driverName)
.option("header","false")
.jdbc(url1, "sourceTable", connectionProperties)
错误:
java.lang.RuntimeException: Multiple sources found for jdbc (org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider, org.apache.spark.sql.execution.datasources.jdbc.DefaultSource), please specify the fully qualified class name.
at scala.sys.package$.error(package.scala:27)
at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:591)
at org.apache.spark.sql.execution.datasources.DataSource.providingClass$lzycompute(DataSource.scala:86)
at org.apache.spark.sql.execution.datasources.DataSource.providingClass(DataSource.scala:86)
at org.apache.spark.sql.execution.datasources.DataSource.write(DataSource.scala:424)
at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:215)
at org.apache.spark.sql.DataFrameWriter.jdbc(DataFrameWriter.scala:446)
at com.rxxxrp.opanada_launus.LoadData.loadDFToDB(LoadData.scala:140)
at com.rxxxrp.opanada_launus.jkanadaTaunus$.main(Tanadaaunus.scala:139)
at com.rxxxrp.jkanada_tllunus.opanadalaunus.main(Tanadaaunus.scala)
【问题讨论】:
标签: scala apache-spark jdbc hive