package operationMysql import config.conf.{sc, spark_session} import org.apache.spark.sql.DataFrame object readingMysqlOperation { def main(args: Array[String]): Unit = { val df: DataFrame = spark_session.read .format("jdbc") .option("url", "jdbc:mysql://localhost:3306/junsheng?useUnicode=true&characterEncoding=utf-8") .option("dbtable", "订单") .option("user", "root") .option("password", "123456") .load() df.show() } }