小编Dig*_*han的帖子

Spark:java.sql.SQLException:找不到适用于 jdbc 的驱动程序:postgresql://localhost/postgres

在我的 Spark 应用程序中,我尝试使用以下行连接到本地 Postgres 数据库:

val conn = DriverManager.getConnection("jdbc:postgresql://localhost/postgres", "postgres", "*Qwerty#")
Run Code Online (Sandbox Code Playgroud)

Postgres 服务器在端口 5432(默认)上运行。我也尝试过包括端口。我也尝试过Class.forName("org.postgresql.Driver"),但它抛出 ClassNotFoundException。我已确保驱动程序位于 ClassPath 中。

我正在本地模式下运行 Spark。

但我得到了上述例外。

我已经通过此处提到的方式包含了 jdbc 驱动程序sbt: https: //mvnrepository.com/artifact/org.postgresql/postgresql/42.2.2

postgresql jdbc apache-spark

1
推荐指数
1
解决办法
5831
查看次数

标签 统计

apache-spark ×1

jdbc ×1

postgresql ×1