[R] ODBC access

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Aug 25 20:16:10 CEST 2003


So follow the instructions more precisely.  You don't say which manual, 
but the R Data Import/Export Manual says

We use a database @code{testdb} we created earlier, and had the DSN (data
source name) set up in @file{~/.odbc.ini} under @code{unixODBC}.  Exactly
the same code worked using MyODBC to access a MySQL database under Linux
or Windows (where MySQL also maps names to lowercase).  Under Windows,
@acronym{DSN}s are set up in the @acronym{ODBC} applet in the Control
Panel (`Data Sources (ODBC)' in the `Administrative Tools' section on
2000/XP).

The message means that you didn't do set up the DSN.  Use your OS 
documentation to learn how to do that: it's not an R issue.

Hint: you may find it easier to use odbcDriverConnect under Windows
(you do seem to be using Windows, although you neglected to tell us that, 
also).


On Mon, 25 Aug 2003, gfaieta at katamail.com wrote:

> Hello everybody,

> I have tried to connect to external databases (specifically, to a MS
> Access database in my computer) from R using the RODBC package.
> Unfortunatelly I haven't been able to do it, even if I 'followed' the
> instructions in the manual. COuld someone please help me?
> 
> I have a MS Access database in my computer and I went to the control panel in order to create a DSN file linked to that database. When I'm in R I tried to coneect to it using the command 
> odbcConnect("testdb")
> but it doesn't work. I received these messages:
> Warning messages: 
> 1: [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified 
> 2: ODBC connection failed in: odbcDriverConnect(paste("DSN=", dsn, ";UID=", uid, ";PWD=", pwd,  

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list