No suitable driver found for jdbc:mysql://

Hi,

I am trying to pull data from MYSQL DB table to Spark. But the command is failing please check and let me know ASAP…
Steps:: -----------------------
scala> val prop = new java.util.Properties

scala> prop.put(“host”,“ip-172-31-13-154”)
res23: Object = null

scala> prop.put(“user”,“sqoopuser”)
res24: Object = null

scala> prop.put(“password”,“xxxxxxxxxx”)
res25: Object = null

scala> prop.put(“driverClass”,“com.mysql.jdbc.Driver”)
res26: Object = null

scala> val uri = “jdbc:mysql://ip-172-31-13-154/retail_db_13072017”
uri: String = jdbc:mysql://ip-172-31-13-154/retail_db_13072017

scala> val table = “categories”
table: String = categories

scala> val categoryDF = hiveContext.read.jdbc(uri,table,prop)

java.sql.SQLException: No suitable driver found for jdbc:mysql://ip-172-31-13-154/retail_db_13072017

Thanks,
Mahesh .H

Hi @maheshharuvaiah8134

The link can help you:spark_mysql_connection

1 Like