标签:create logger string ssi master mysql unit show def
import org.apache.log4j.{Level, Logger}
import org.apache.spark.sql.SparkSession
object SparkSql {
def main(args: Array[String]): Unit ={
Logger.getLogger("org").setLevel(Level.ERROR)
val spark = SparkSession.builder().appName("test").master("local[2]").getOrCreate()
val df = spark.read
.format("jdbc")
.option("url", "jdbc:mysql://localhost:3306/要访问的数据库名")
.option("driver", "com.mysql.jdbc.Driver")
.option("dbtable", "表名")
.option("user", "用户名")
.option("password", "密码")
.load()
df.show()
}
}
标签:create logger string ssi master mysql unit show def
原文地址:https://www.cnblogs.com/wddqy/p/11969831.html