View source: R/db_conn-generic.R
db.connect.dsn | 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.dsn(dsn.key, db.ini = "~/db.ini",
default.schemas = NULL, verbose = TRUE, quick = FALSE)
dsn.key |
A string. The key name of the DSN file, containing info about connections. The useful key names of a dsn are: username, password, host, port, dbname, driver. The key names are case sensitive. |
db.ini |
A string, default is '~/db.ini'. db.ini is the path of the DSN file. |
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: Extensions Team at Pivotal Inc.
Maintainer: Hao Wu, Pivotal Inc. hawu@pivotal.io
db.connect
connects a connection.
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 ~/db.ini contains all information about connections
## and there is a dsn key named foobar in db.ini. Each dsn has
## multiple key-value pairs. The useful key names are:
## username, password, host, port, dbname, driver.
cid <- db.connect.dsn('foobar', db.ini = '~/db.ini', 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.