val data = sc.parallelize(List(("192.168.34.5", "pc", 5, 12)))
val url = "jdbc:mysql://ip:端口/数据库?user=username&password=password”
classOf[com.mysql.jdbc.Driver]
val conn = DriverManager.getConnection(url)
上面写会有报Unknown MySQL server host的问题,改成下面写就ok,我也没弄清楚是什么问题,有知道的小伙伴可以告诉我呢!
val data = sc.parallelize(List(("192.168.34.5", "pc", 5, 12)))
val url = "jdbc:mysql://ip:端口/数据库?"///user=username&password=password”
classOf[com.mysql.jdbc.Driver]
val conn = DriverManager.getConnection(url, user, pwd)
网友评论