I want to insert a record in to the table using Spark SQLContext.
Here is the sample code I have done to retrieve the data
Class.forName(dbDriver);
Map<String, String> options = new HashMap<String, String>();
options.put("url", dbUrl);
options.put("dbtable", dbTable);
options.put("driver", dbDriver);
SparkConf conf = new SparkConf().setAppName("JAVA_SPARK")
.setMaster("local[2]").set("spark.ui.port", "7077");
JavaSparkContext jsc = new JavaSparkContext(conf);
SQLContext sqlContext = new SQLContext(jsc);
DataFrame dframe = sqlContext.read().format("jdbc")
.options(options).load();
dframe.show();
How do I insert a new record in to the table? dframe.show() operation is working fine for me.