Connect to a Postgres Database

connect(
  user,
  password,
  port,
  server,
  extraSettings = NULL,
  oracleDriver = "thin",
  connectionString = NULL,
  pathToDriver = system.file(package = "pg13", "driver"),
  verbose = TRUE
)

Arguments

user

The user name used to access the server.

password

The password for that user.

port

(optional) The port on the server to connect to.

server

The name of the server.

extraSettings

(optional) Additional configuration settings specific to the database provider to configure things as security for SSL. These must follow the format for the JDBC connection for the RDBMS specified in dbms.

oracleDriver

Specify which Oracle drive you want to use. Choose between "thin" or "oci".

connectionString

The JDBC connection string. If specified, the server, port, extraSettings, and oracleDriver fields are ignored. If user and password are not specified, they are assumed to already be included in the connection string.

pathToDriver

Path to a folder containing the JDBC driver JAR files. See downloadJdbcDrivers for instructions on how to download the relevant drivers.

verbose

If TRUE, returns console messages when a connection has been secured.

Value

An object that extends DBIConnection in a database-specific manner. This object is used to direct commands to the database engine.

See also

Other connection functions: conn_db(), connect_ff(), dc0(), dc(), quietly.conn_db()