Support Questions
Find answers, ask questions, and share your expertise

Can we insert data in RDBMS table using Spark Streaming?

Can we insert data in RDBMS table using Spark Streaming?

New Contributor

Do Spark streaming support copying to MS SQL or MYSQL? I am getting error:

java.lang.UnsupportedOperationException: Data source jdbc does not support streamed writing

1 REPLY 1

Re: Can we insert data in RDBMS table using Spark Streaming?

Explorer
Yes, you have to use foreachRDD from https://stackoverflow.com/questions/44088090/spark-streaming-saving-data-to-mysql-with-foreachrdd-in... // JDBC writer configuration val connectionProperties = new Properties() connectionProperties.put("user", "root") connectionProperties.put("password", "*****") structuredData.foreachRDD { rdd => val df = rdd.toDF() // create a dataframe from the schema RDD df.write.mode("append") .jdbc("jdbc:mysql://192.168.100.8:3306/hadoopguide", "topics", connectionProperties) }