[Original Post]
I have seen a couple of similar SO questions but I don't think any of them are related to OS.
Long story short, this is what I see when I try to establish a ssl connection to Redshift.
library(RPostgreSQL)
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv,
host = "XXXXXXXX.us-east-1.redshift.amazonaws.com",
port = 5439,
user = "XXXXXXXX",
password = "XXXXXXXX",
dbname = "db1")
> Error in postgresqlNewConnection(drv, ...) :
RS-DBI driver: (could not connect [email protected] on dbname "db1")
I have tried the following and none of them worked.
I have an EC2 node (Ubuntu) in AWS and another Mac Pro in office, so I tried to use the same code to connect from both.
The Linux system works with copying & pasting the exact same code. Here is the Sys.info()
on the Linux server:
sysname Linux
release 3.13.0-48-generic
version #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015
nodename ip-xx-xxx-xx-xx
machine x86_64
login unknown
user bcui
effective_user bcui
However, the Mac Pro failed with the exact same error message. Here is the Mac Sys.info()
(same as my Mac laptop):
sysname Darwin
release 15.3.0
version Darwin Kernel Version 15.3.0:
Thu Dec 10 18:40:58 PST 2015;
root:xnu-3248.30.4~1/RELEASE_X86_64
nodename bcui-MBP.local
machine x86_64
login bcui
user bcui
effective_user bcui
I am wondering what could be different between the Mac and Linux configuration that causes this error message?
[Update 2016/02/10]
I have tried to uninstall R and all related files, and then reinstall R from homebrew:
brew tap homebrew/science
brew install R
Same error message:
> Error in postgresqlNewConnection(drv, ...) :
RS-DBI driver: (could not connect [email protected] on dbname "db1")
FYI, I can connect to other non-ssl Redshift clusters using the same code, so it could be something related to openssl on Mac.
[Update 2016/02/11]
More info from @MasashiMiyazaki's comment:
I have used psql
via CLI to connect and it works fine. In addition, I can also connect successfully using the Python module psycopg2
. However, I will have to disable this line from .bash_profile
in order for them to work:
export DYLD_LIBRARY_PATH=/usr/lib:$DYLD_LIBRARY_PATH
Taking a shot in the dark here. Have you tried RPostgres?
Install it like so
# install.packages("devtools")
devtools::install_github("RcppCore/Rcpp")
devtools::install_github("rstats-db/DBI")
devtools::install_github("rstats-db/RPostgres")
Then test it out
library(DBI)
library(RPostgres)
con <- dbConnect(RPostgres::Postgres(),
host = "XXXXXXXX.us-east-1.redshift.amazonaws.com",
port = 5439,
user = "XXXXXXXX",
password = "XXXXXXXX",
dbname = "db1")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With