spark2.3 加载postgresql数据 java.sql.SQLException: No suitable driver

项目中spark2.3 加载postgresql数据 java.sql.SQLException: No suitable driver

项目中spark2.3 加载postgresql数据时报错  java.sql.SQLException: No suitable driver

原代码为:

sparkSession.read.format("jdbc").options(Map("url" -> url, "user" -> user, "password" -> password, "dbtable" -> tableName)).option("query", "SELECT u_user FROM user_real_time").load()


后改为:sparkSession.read.format("jdbc").option("driver", "org.postgresql.Driver").options(Map("url" -> url, "user" -> user, "password" -> password, "dbtable" -> tableName)).option("query", "SELECT u_user FROM user_real_time").load()

问题解决

你可能感兴趣的:(spark2.3 加载postgresql数据 java.sql.SQLException: No suitable driver)