ConnectRS: Connect to AWS Redshift DBMS using JDBC Driver

Description Usage Arguments Details Value Examples

Description

Function to establish JDBC driven connection to AWS Redshift DBMS. Credentials and cluster information required. Communication with Redshift DB, which runs on a modified PostgreSQL dialect, can require special Redshift PostgreSQL code.

Usage

1
2
ConnectRS(yrurl = NULL, host = NULL, dbname = NULL, user = NULL,
  driverClass = NULL, classPath = NULL, identifier.quote = NULL)

Arguments

yrurl

A character string of the URL to the cluster of the DBMS. Paste only the following part of the URL to function input: yrurl = "<JDBCURL>:<port>/<dbname>?user=<user>&". If yrurl is supplied, ConnectRS requires no further arguments as inputs.

host

A character string of the host

dbname

A character string of the DB name

user

A character string of the username

driverClass

A character string of with the Class of the JDBC Driver. Check AWS Documentation for up to date driver class and adjust following link if necessary "com.amazon.redshift.jdbc42.Driver". If new driver class 43 is available enter e.g.: "com.amazon.redshift.jdbc43.Driver"

classPath

A character string of the path to the folder containing the JDBC-Driver (a .jar file)

identifier.quote

Optional argument; NA by default; can impact functions as e.g. dbWriteTable or dbReadTable if not chosen correctly; see also JDBC or AWS Documentation

Details

Either provide: yrurl OR all other arguments. Connection to DB not visible in RStudio connection pane. Disconnect by using e.g. dbDisconnect

For details on the JDBC cluster URL see: AWS Documentation

Value

Returns a connection object which can be used to query the AWS Redshift DBMS with e.g.: dbGetQuery.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
Not generally executable examples:

con <- ConnectRS(yrurl = "jdbc:redshift://redshift.adsbexchange.com:5439/adsbx?user=random.user&")
(when the url is given)

where:
<JDBCURL> <- jdbc:redshift://redshift.adsbexchange.com
<port> <- 5439
<dbname> <- adsbx
user=<user> <- random.user
Password retrieved via popo-up

dbDisconnect(con)

con <- ConnectRS(host = "redshift.adsbexchange.com", dbname = "adsbx",
user = "random.user", driverClass = "com.amazon.redshift.jdbc42.Driver",
classPath = "C:/.../JDBC/RedshiftJDBC42-1.2.15.1025.jar", identifier.quote = "`")
Password retrieved via popo-up

dbDisconnect(con)
## End(Not run)

RichandFamous/adsb-R-project documentation built on May 5, 2019, 3:53 p.m.