dbConnect,PqDriver-method: Connect to a PostgreSQL database.
Description
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.
Usage
# S4 method for PqDriver
dbConnect(drv, dbname = NULL, host = NULL,
port = NULL, password = NULL, user = NULL, service = NULL, ...,
bigint = c("integer64", "integer", "numeric", "character"))
# S4 method for PqConnection
dbDisconnect(conn, ...)
Arguments
drv
RPostgres::Postgres()
dbname
Database name. If NULL, defaults to the user name.
Note that this argument can only contain the database name, it will not
be parsed as a connection string (internally, expand_dbname is set to
false in the call to
PQconnectdbParams()).
host, port
Host and port. If NULL, will be retrieved from
PGHOST and PGPORT env vars.
Name of service to connect as. If NULL, will be
ignored. Otherwise, connection parameters will be loaded from the pg_service.conf
file and used. See http://www.postgresql.org/docs/9.6/static/libpq-pgservice.html
for details on this file and syntax.
# NOT RUN {if (postgresHasDefault()) {
library(DBI)
# Pass more arguments as necessary to dbConnect()con <- dbConnect(RPostgres::Postgres())
dbDisconnect(con)
}
# }