Spark intergating with mysql

how to integrate spark and mysql

Hi, Sundar.

You can connect spark with Mysql by creating sqlcontext object.
val sqlcontext = new org.apache.spark.sql.SQLContext(sc).
Kindly refer to the below class :- https://cloudxlab.com/assessment/displayslide/616/spark-sql-working-with-jdbc
and this article :- How to create the Dataframe for MYsql table

All the best!

Hi Sundar

I want to create a dataframe from mysql database using python

df_mysql=sparkdriver.read.format(‘jdbc’).option(‘url’,‘jdbc:mysql://hostname:3306’).option(‘driver’,‘com.mysql.jdbc.Driver’).option(‘user’,;username’).option(‘password’,‘password’).option(‘dbtabe’,‘dd.tablename’).load()

i used this

but i am getting an error com.mysql.jdbc.Driver class not found
please help me in solving this issue