This function creates and initializes a PostgreSQL client. It returns an driver object that allows you to connect to one or several PostgreSQL servers.
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
number of records to fetch at one time from the database.
should the client code be reloaded (reinitialize)?
Setting this to
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.
PostgreSQLDriver that extends
This object is required to create connections
to one or several PostgreSQL database engines.
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
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
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.
David A. James
On database managers:
On connections, SQL statements and resultSets:
On transaction management:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
## Not run: # create a PostgreSQL instance and create one connection. > m <- dbDriver("PostgreSQL") <PostgreSQLDriver:(4378)> > con <- dbConnect(m, user="username", password="passwd", dbname="database_name") > rs <- dbSendQuery(con, "select * sales where price < 10") > df <- fetch(rs, n = 50) > dbHasCompleted(rs)  FALSE > df2 <- fetch(rs, n = -1) > dbHasCompleted(rs)  TRUE > dbClearResult(rs) > dbListTables(con) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.