PostgreSQL
Instantiate a PostgreSQL client from the current R or S-Plus session
This function creates and initializes a PostgreSQL client. It returns an driver object that allows you to connect to one or several PostgreSQL servers.
Usage
PostgreSQL(max.con = 16, fetch.default.rec = 500, force.reload = FALSE)
Arguments
- max.con
Maximum number of connections that are intended to have open at one time. There's no intrinic limit, since strictly speaking this limit applies to PostgreSQL servers, but clients can have (at least in theory) more than this. Typically there are at most a handful of open connections, thus the internal
RPostgreSQL
code uses a very simple linear search algorithm to manage its connection table.- fetch.default.rec
number of records to fetch at one time from the database. (The
fetch
method uses this number as a default.)- force.reload
should the client code be reloaded (reinitialize)? Setting this to
TRUE
allows you to change default settings. Notice that all connections should be closed before re-loading.
Details
This object is a singleton, that is, on subsequent invocations it returns the same initialized object.
This implementation allows you to connect to multiple host servers and run multiple connections on each server simultaneously.
Value
An object PostgreSQLDriver
that extends
dbDriver
and
dbObjectId
.
This object is required to create connections
to one or several PostgreSQL database engines.
Side Effects
The R/S-Plus client part of the database communication is initialized,
but note that connecting to the database engine needs to be done through
calls to dbConnect
.
User authentication
The passed string can be empty to use all default parameters, or it can contain one or more parameter settings separated by comma. Each parameter setting is in the form parameter = "value". Spaces around the equal sign are optional.
The most important parameters are user
, password
,
host
, dbname
, port
, tty
and options
.
References
See https://cran.r-project.org/package=DBI for more details on the R/S-Plus database interface.
See the documentation at the PostgreSQL Web site http://www.postgresql.org for details.
See Also
On database managers:
On connections, SQL statements and resultSets:
dbConnect
dbDisconnect
dbSendQuery
dbGetQuery
fetch
dbClearResult
On transaction management:
On meta-data:
summary
dbGetInfo
dbGetDBIVersion
dbListTables
dbListConnections
dbListResults
dbColumnInfo
dbGetException
dbGetStatement
dbHasCompleted
dbGetRowCount
dbGetRowsAffected
Examples