【发布时间】:2015-01-17 18:32:45
【问题描述】:
我正在尝试使用 Hive 和 MySQL 支持的元数据存储来配置 Apache Spark。我收到以下异常
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://<correct-information>
我可以使用以下命令启动 spark-shell
bin/spark-shell --jars /usr/share/java/mysql-connector-java.jar
然后我运行了以下命令
scala> Class.forName("com.mysql.jdbc.Driver")
res0: Class[_] = class com.mysql.jdbc.Driver
scala> new org.apache.spark.sql.hive.HiveContext(sc).sql("select * from table limit 1").first
我得到的异常很多,但这里是最上面的
Unable to open a test connection to the given database. JDBC url = jdbc:mysql://<hostname>/metastore, username = hiveuser. Terminating connection pool. Original Exception: ------
java.sql.SQLException: No suitable driver found for jdbc:mysql://<hostname>/metastore
这个非常简单的查询在 hive 命令行中运行良好。第一个 spark 命令显示 mysql JDBC 驱动程序在类路径上,但它似乎仍然无法找到它。有人有什么想法吗?
谢谢
【问题讨论】:
标签: mysql jdbc hive apache-spark