In my spark application, I am trying to connect to local Postgres database using following line:
val conn = DriverManager.getConnection("jdbc:postgresql://localhost/postgres", "postgres", "*Qwerty#")
Postgres server is running on port 5432 (default). I have also tried including the port.
I have also tried Class.forName("org.postgresql.Driver")
but it throws ClassNotFoundException. I have made sure that the driver is in the ClassPath.
I am running spark in the local mode.
But I am getting the above exception.
I have included the jdbc driver via sbt
as mentioned here :
https://mvnrepository.com/artifact/org.postgresql/postgresql/42.2.2