odbcConnect establishes a connection to the specified DSN, and
odbcDriverConnect allows a more flexible specification via a
odbcConnect uses the connection string
omitting the last two components if they are empty.
See the examples for other uses of connection strings.
Under the Windows GUI, specifying an incomplete
example the default
"", will bring up a dialog box to complete the
information required. (This does not work from
unless a driver is specified, a Windows restriction.)
For DBMSs that translate table and column names
be set appropriately. Allowable values are
"tolower" as well as the names of
databases where the behaviour is known to us (currently
"mysql", which maps to lower case on Windows but not on Linux,
"postgresql" (lower), and
"msaccess" (nochange)). If
case is not specified, the default is
the appropriate value can be figured out from the DBMS name reported
by the ODBC driver. It is likely that
"toupper" is desirable
on IBM's DB2, but this is not enforced.
(The DBase driver is unusual: it preserves names on reading, but
converts both table and column names to upper case on writing, and
truncates table names to 8 characters. RODBC does not attempt to do
any mapping for that driver.)
readOnlyOptimize may do nothing, and is not
guaranteed to enforce read-only access. With drivers that support it,
it is used to optimize locking strategies, transaction management and
so on. It does make access to Mimer read-only, and has no effect on
odbcReConnect re-connects to a database using the
settings of an existing (and presumably now closed) channel object.
Arguments given in the original call can be overridden as needed.
Note that if a password is supplied (either as a
or as part of the DSN) it may be stored in the
connection.string element of the return value, but the value is
(from RODBC 1.3-0) replaced by
******. (This will break
odbcConnectExcel are convenience wrappers to generate
connection strings for those file types. The files given can be
relative to the R working directory or absolute paths (and it seems
also relative to the user's home directory). The file name can be
omitted, which will on
Rgui bring up a dialog box to search for
Note: they will only work with English-language 32-bit versions
of the Microsoft drivers, which may or may not be installed in other
locales, and are not usable from 64-bit R. The
work with the drivers which are installed with Office 2007/2010 and
give access to formats such as
These drivers are also available separately and there is a 64-bit
version: see the package manual. (You must have the 32-bit drivers
when using 32-bit R and the 64-bit drivers when using 64-bit R:
otherwise there will be a cryptic message about a driver not being
found. And the 64-bit drivers cannot be installed alongside 32-bit
Microsoft Office, and vice versa.
See the package manual for some of the peculiarities of the Excel
readOnly = TRUE may allow very limited changes (to
insert and update rows).
If it is possible to set the DBMS or ODBC driver to communicate in the
character set of the R session then this should be done. For
example, MySQL can set the communication character set via SQL,
e.g. SET NAMES 'utf8'.