db.connect | R Documentation |
Create a connection to a PostgreSQL or Greenplum (Pivotal) database. One can create multiple connections to multiple databases. The connections are indexed by an integer starting from 1.
db.connect(host = "localhost", user = Sys.getenv("USER"), dbname = user,
password = "", port = 5432, conn.pkg = "RPostgreSQL",
default.schemas = NULL, verbose = TRUE, quick = FALSE)
host |
A string, default is "localhost". The name or IP of the host where the database is located. |
user |
A string, default is the user's username. The username used to connect to the database. |
dbname |
A string, default is the same as the username. The name of the database that you want to connect to. |
password |
A string, default is "". The password string used to connect to the database. |
port |
An integer, default is 5432. The port number used to connect to the database. |
conn.pkg |
A string, default is "RPostgreSQL". The name of the R package used to connect to the database. Currently, only RPostgreSQL is supported, but the support for other packages such as RODBC can be easily added. |
default.schemas |
A string, default is |
verbose |
A logival value, default is |
quick |
A logical value, default is |
An integer, the ID number for the newly created connection.
Right now only PostgreSQL and Greenplum databases are supported.
Author: Predictive Analytics Team at Pivotal Inc.
Maintainer: Frank McQuillan, Pivotal Inc. fmcquillan@pivotal.io
db.disconnect
disconnects a connection.
db.list
lists all active connections.
connection info
the functions that extract information
about the connection.
conn.eql
tests whether two connections are the same.
db.search.path
and db.default.schemas
displays or sets the search path (i.e. default schemas) in the
connected database.
## Not run:
## connect to a database
## set up the database connection
## Assume that .port is port number and .dbname is the database name
cid <- db.connect(port = .port, dbname = .dbname, verbose = FALSE)
db.disconnect(cid, verbose = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.