Postgres driver
DBI::dbConnect()
establishes a connection to a database.
Set drv = RPostgres::Postgres()
to connect to a SQL database
using the RPostgres package.
Manually disconnecting a connection is not necessary with RPostgres, but still recommended; if you delete the object containing the connection, it will be automatically disconnected during the next GC with a warning.
Postgres() ## S4 method for signature 'PqDriver' dbConnect( drv, dbname = NULL, host = NULL, port = NULL, password = NULL, user = NULL, service = NULL, ..., bigint = c("integer64", "integer", "numeric", "character"), check_interrupts = FALSE, timezone = "UTC", timezone_out = NULL ) ## S4 method for signature 'PqConnection' dbDisconnect(conn, ...)
drv |
Should be set to |
dbname |
Database name. If |
host, port |
Host and port. If |
user, password |
User name and password. If |
service |
Name of service to connect as. If |
... |
Other name-value pairs that describe additional connection options as described at http://www.postgresql.org/docs/9.6/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS |
bigint |
The R type that 64-bit integer types should be mapped to, default is bit64::integer64, which allows the full range of 64 bit integers. |
check_interrupts |
Should user interrupts be checked during the query execution (before
first row of data is available)? Setting to |
timezone |
Sets the timezone for the connection. The default is |
timezone_out |
The time zone returned to R, defaults to |
conn |
Connection to disconnect. |
if (postgresHasDefault()) { library(DBI) # Pass more arguments as necessary to dbConnect() con <- dbConnect(RPostgres::Postgres()) dbDisconnect(con) }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.