浏览代码

更新Product表--kettle

deng 5 年之前
父节点
当前提交
93e8119a1d
共有 2 个文件被更改,包括 62 次插入0 次删除
  1. 25 0
      filetoes.txt
  2. 37 0
      xueXiGit.txt

+ 25 - 0
filetoes.txt

@@ -0,0 +1,25 @@
+import java.util.Properties
+
+import org.apache.spark
+import org.apache.spark.sql.SparkSession
+
+object ToSqlServer {
+  case class studeng(id:Int,value:String)
+  def main(args: Array[String]): Unit = {
+    System.setProperty("hadoop.home.dir","E:\\Scala\\hadoop-2.6.5")
+    val ss = SparkSession.builder().appName("test").master("local").getOrCreate()
+    val sc = ss.sparkContext
+    var rdd1 = sc.textFile("./src/main/scala/data/outPut/sum22.txt")
+    var rdd2 =rdd1.map(_.split(","))
+    var rdd3 = rdd2.map(f => {studeng(f(0).toInt,f(1))})
+    val sql = ss.sqlContext
+    var df = sql.createDataFrame(rdd3)
+    df.createOrReplaceTempView("ss")
+    var df1 = sql.sql("select * from ss limit 10")
+    val prop = new Properties()
+    prop.setProperty("user","sa")
+    prop.setProperty("password","saljhy!@#")
+    prop.setProperty("driver","com.microsoft.sqlserver.jdbc.SQLServerDriver")
+    df1.write.mode("overwrite").jdbc("jdbc:sqlserver://192.168.50.32:1433/Mall","Sum",prop)
+  }
+}

+ 37 - 0
xueXiGit.txt

@@ -0,0 +1,37 @@
+git add file   (添加文件的缓存)
+git commit -m "描述"    (添加描述)
+git push -u origin master  (提交到git仓库)
+
+
+
+
+config文件
+
+[core]
+	
+repositoryformatversion = 0
+	
+filemode = true
+	
+bare = false
+	
+logallrefupdates = true
+	
+symlinks = true
+	
+ignorecase = true
+[remote "origin"]
+	
+url = http://deng@192.168.20.122:3000/deng/MemberCenter_paChong.git
+	
+fetch = +refs/heads/*:refs/remotes/origin/*
+
+[http]
+
+postBuffer = 524288000
+
+[branch "master"]
+	
+remote = origin
+	
+merge = refs/heads/master