def main(args: Array[String]): Unit = {
//spark SparkSession对象 操作sql语句
val spark = SparkSession.builder().config(conf).getOrCreate()
val sc = spark.sparkContext
import spark.implicits._
//jdbc
val prop = new Properties()
prop.put("user","root")
prop.put("password","root")
//创建链接读取
val df = spark.read.jdbc("jdbc:mysql://localhost:3306/数据库","user",prop)
df.show()
sparksql之JDBC支持
猜你喜欢
转载自blog.csdn.net/L__MY/article/details/88870608
今日推荐
周排行