Connect to a ODBC compatible database
# S4 method for OdbcDriver
dbConnect(
drv,
dsn = NULL,
...,
timezone = "UTC",
timezone_out = "UTC",
encoding = "",
bigint = c("integer64", "integer", "numeric", "character"),
timeout = 10,
driver = NULL,
server = NULL,
database = NULL,
uid = NULL,
pwd = NULL,
dbms.name = NULL,
attributes = NULL,
.connection_string = NULL
)
an object that inherits from DBIDriver, or an existing DBIConnection object (in order to clone an existing connection).
The Data Source Name.
Additional ODBC keywords, these will be joined with the other arguments to form the final connection string.
The Server time zone. Useful if the database has an internal
timezone that is not 'UTC'. If the database is in your local timezone set
to Sys.timezone()
. See OlsonNames()
for a complete list of available
timezones on your system.
The time zone returned to R. If you want to display
datetime values in the local timezone, set to Sys.timezone()
.
The text encoding used on the Database. If the database is
not using UTF-8 you will need to set the encoding to get accurate re-encoding.
See iconvlist()
for a complete list of available encodings on your system.
Note strings are always returned UTF-8
encoded.
The R type that SQL_BIGINT
types should be mapped to,
default is bit64::integer64, which allows the full range of 64 bit
integers.
Time in seconds to timeout the connection attempt. Setting a
timeout of Inf
indicates no timeout. (defaults to 10 seconds).
The ODBC driver name.
The server hostname.
The database on the server.
The user identifier.
The password to use.
The database management system name. This should normally
be queried automatically by the ODBC driver. This name is used as the class
name for the OdbcConnect object returned from dbConnect()
. However if the
driver does not return a valid value it can be set manually with this
parameter.
An S4 object of connection attributes that are passed prior to the connection being established. See ConnectionAttributes.
A complete connection string, useful if you are copy pasting it from another source. If this argument is used any additional arguments will be appended to this string.
The connection string keywords are driver dependent. The parameters documented here are common, but some drivers may not accept them. Please see the specific driver documentation for allowed parameters, https://www.connectionstrings.com is also a useful resource of example connection strings for a variety of databases.