charmander
charmander

Reputation: 1085

Error in connecting R to Redshift

I'm trying to connect RStudio to Amazon Redshift via JDBC and this is what I tried to run:

driver <- JDBC("com.amazon.redshift.jdbc42.Driver", "~/Downloads/RedshiftJDBC42-1.2.1.1001.jar", identifier.quote="`")
# url <- "<JDBCURL>:<PORT>/<DBNAME>?user=<USER>&password=<PW>
url <- "jdbc:redshift://<cluster-name>.<xxxxxx>.us-east-1.redshift.amazonaws.com:5439/<dbname>?user=<username>&password=<password>"

conn <- dbConnect(driver, url)

When executing dbConnect(), I get the following error:

Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1],  : 
  java.sql.SQLException: [Amazon](500150) Error setting/closing connection: Operation timed out.

Any idea what is causing this and how to fix it?

Upvotes: 0

Views: 1204

Answers (1)

charmander
charmander

Reputation: 1085

Update: There was a problem with access through security groups. If you're having a similar issue, check the inbound rules of your security group and make sure they allow access to Redshift via your IP.

Upvotes: 1

Related Questions