我正在尝试使用 Spark Streaming 将 HDFS 中的镶木地板文件复制到 MS Sql Server。我正在为 MS SQL Server 使用 JDBC 驱动程序。我的代码是:
val spark = SparkSession.builder().master("yarn").appName("StreamAFile").getOrCreate();
val userSchema = new StructType().add("mandt","string").add("lifnr","string").add("land1","string").add("name1","string").add("name2","string");
val myDF = spark.readStream.format("parquet").schema(userSchema).load("/parquetfilepath/*");
val query = myDF.writeStream.format("jdbc").option("driver","net.sourceforge.jtds.jdbc.Driver").option("dbtable","mytable").option("user","username").option("password","password").option("checkpointLocation","/homedirectory/").start("jdbc:jtds:sqlserver://SQLServer1:1433;DatabaseName=MyDB");
我收到错误:
java.lang.UnsupportedOperationException: Data source jdbc does not support streamed writing
如果有人以前在此工作过,请提供修复。