You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@zeppelin.apache.org by Jose Rivera-Rubio <jo...@internavenue.com> on 2015/06/15 13:54:09 UTC

MySQL connection

Hi guys,

I'm trying to connect to my MySQL database with the new data sources API to
load tables in datafraems. In the Spark shell this is straightforward and I
just need to launch the shell with

SPARK_CLASSPATH=/path/to/mysql-connector-java-5.1.6.jar bin/spark-shell
--master local[2]

and then run something like

val sqlContext = new org.apache.spark.sql.SQLContext(sc)

val df = sqlContext.load("jdbc", Map(
      "url" -> "jdbc:mysql://ip.of.db/dbname?user=dbuser&password=dbpass",
      "dbtable" -> "nameOfTable"))

and the data will be loaded in the Spark shell.

However, if I want to run this in a Zeppelin paragraph I get the following
error:

java.sql.SQLException: No suitable driver found for jdbc:mysql:...

even if I add the following configuration in the Interpeter GUI
spark.executor.extraLibraryPath
/path/to/mysql/jar

Alternatively, if I opt for the dependency loading mechanism
z.load("mysql:mysql-connector-java:5.1.6")
I get the same no suitable driver found when I want to store the mysql
table in the dataframe.

Any ideas?

Thanks!