Connect to a DBMS going through the appropriate authentication procedure.
Some implementations may allow you to have multiple connections open, so you
may invoke this function repeatedly assigning its output to different
The authentication mechanism is left unspecified, so check the
documentation of individual drivers for details.
dbCanConnect() to check if a connection can be established.
an object that inherits from DBIDriver, or an existing DBIConnection object (in order to clone an existing connection).
authentication arguments needed by the DBMS instance; these
dbConnect() returns an S4 object that inherits from DBIConnection.
This object is used to communicate with the database engine.
format() method is defined for the connection object.
It returns a string that consists of a single line of text.
DBI recommends using the following argument names for authentication
user for the user name (default: current user)
password for the password
host for the host name (default: local connection)
port for the port number (default: local connection)
dbname for the name of the database on the host, or the database file
The defaults should provide reasonable behavior, in particular a
local connection for
host = NULL. For some DBMS (e.g., PostgreSQL),
this is different to a TCP/IP connection to
In addition, DBI supports the
bigint argument that governs how
64-bit integer data is returned. The following values are supported:
"integer": always return as
integer, silently overflow
"numeric": always return as
numeric, silently round
"character": always return the decimal representation as
"integer64": return as a data type that can be coerced using
as.integer() (with warning on overflow),
dbDisconnect() to disconnect from a database.
1 2 3 4 5 6 7 8 9
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.