0 votes
1 view
in Big Data Hadoop & Spark by (11.5k points)

I want to run my existing application with Apache Spark and MySQL.

1 Answer

0 votes
by (32.5k points)
edited by

Using Scala, the below commands will work:

import org.apache.spark.sql.SQLContext

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

val dataframe_mysql = sqlcontext.read.format("jdbc").option("url", "jdbc:mysql://Public_IP:3306/YOUR_DB_NAME").option("driver", "com.mysql.jdbc.Driver").option("dbtable", "tblage").option("user", "your_user").option("password", "your_password").load()

dataframe_mysql.show()

If you want to know more about Spark, then do check out this awesome video tutorial:

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...