How to insert Spark DataSet to MemSql using Java Spark

memsql

#1

Hi,

I’m trying to insert a dataset into a memsql table using java spark. I did following list of things but didn’t work out.

a) Added memsql dependency in POM.xml

com.memsql
memsql-connector_2.11
2.0.2

b) Provided memsql conf details in SparkConf.
SparkConf sparkConf = new SparkConf();
sparkConf.setMaster(“local[2]”);
sparkConf.setAppName(“JUstForCheck”);
sparkConf.set(“spark.memsql.defaultDatabase”, “*");
sparkConf.set(“spark.memsql.host”, "");
sparkConf.set(“spark.memsql.port”, “3306”);
sparkConf.set(“spark.memsql.user”, “root”);
sparkConf.set(“spark.memsql.password”, "
”);

c) wordsDataFrame.write().mode(SaveMode.Append).insertInto(“test”);
Note: wordsDataFrame is a DataSet.

Can anyone helps me out to insert data into memsql tables

Thanks
Arun


#2

Hi Arun

We used to have a MemSQL Spark Connector, and it currently is verified to work with 6.7.2 and below. Could you give this a try?


#3

Hi Jacky,

I need it in Java not in scala.

Thanks
Arun