-1

I use this preliminaries to be able to connect to a PostgreSQL Database. They won't work but I can't find any suggestions for the correct notation.

.libPaths(c(.libPaths(), '/opt/spark-1.6.1-bin-hadoop2.6/R/lib'))
Sys.setenv(SPARK_HOME = '/opt/spark-1.6.1-bin-hadoop2.6')
Sys.setenv(PATH = paste(Sys.getenv(c('PATH')), '/opt/spark-1.6.1-bin-hadoop2.6/bin', sep = ':'))
library(SparkR)

d.csv <- "com.databricks:spark-csv_2.11:1.4.0"
d.pg <- "org.postgresql.Driver:postgresql-9.4:1208"

sc <- sparkR.init(sparkPackages=c(d.csv, d.pg))

I have the JAR file stored under "/opt/spark-1.6.1-bin-hadoop2.6/lib/postgresql-9.4.1208.jar" and additionally yum installed the jdbc on my centos6 machine.

When I try to start this the csv library will be found but the JDBC PostgreSQL driver can't be resolved.

    ::::::::::::::::::::::::::::::::::::::::::::::

    ::          UNRESOLVED DEPENDENCIES         ::

    ::::::::::::::::::::::::::::::::::::::::::::::

    :: org.postgresql.Driver#postgresql-9.4;1208: not found

    ::::::::::::::::::::::::::::::::::::::::::::::

Any hint would be great. Thanks a lot.

2 Answers2

0

You use incorrect group id. PostgreSQL artifacts are published under org.postgresql not org.postgresql.Driver so it should be:

org.postgresql:postgresql:9.4.1208
zero323
  • 322,348
  • 103
  • 959
  • 935
  • 2
    @DubravkoDolic You might want to update your question and add what you tried in response to this, because maybe you have some more typos. – Mark Rotteveel Jul 07 '16 at 14:53
  • Still no solution. I tried with the different driver class suggested by zero323 without success. I keep trying. – Dubravko Dolic Jul 12 '16 at 12:24
0

What worked:

d.pg <- "org.postgresql:postgresql:9.4.1208"

It worked with the corresponsing driver. In another case we had trouble with the JAR File and replaced it by just unzipping the SRC into the lib folder. This also worked fine.