简体   繁体   中英

On Hortonworks Sandbox 2.4, Spark use of SQLServer driver results in “No Suitable Driver Found”

HDP version 2.4

I am trying to write to a SQL Server database via the Microsoft SQL Server JDBC driver sqljdbc41.jar. I'm executing the following in Zeppelin:

val foo = sqlContext.jdbc("jdbc:sqlserver://X;databaseName=X;user=X;password=X", "X")

在此处输入图片说明

which yields the "no suitable driver found" error.

This is a common issue and so far I've tried the following, without luck, based on various remedies I've found through the interwebs:

  • add the full path to the JAR for the following properties in spark-defaults.conf:
 spark.driver.extraClassPath spark.executor.extraClassPath spark.files 
  • add SPARK_CLASSPATH with the same JAR path in spark_env.sh

After making these changes I've stopped and started the Spark service through the Ambari interface, and I do see the changes reflected in both the Ambari portal and within the configuration files on the VM.

I did notice that many posts indicate you still have to provide the jar on the classpath when running spark-submit, but I'm accessing through Zeppelin, so not sure how that applies.

Try using JDBC Interpreter with Zeppelin 0.6.0 and configure MySQL driver.

JDBC解释器配置

You can also try to follow http://thedataist.com/tutorial-using-apache-zeppelin-with-mysql/

Perhaps you just need to change the connection string as this post suggests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM