[R-SIG-Mac] RODBC

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Aug 25 19:48:22 CEST 2016


On 25/08/2016 17:24, Emilio wrote:
> Hi,
>
> I'm having trouble reading into R an access table (.accdb) with a Mac OS X 10.11.6
>
> I've created a DSN connection to my data base so when I use the odbcConnect function it returns:
>
> RODBC Connection 1
> Details:
>      case=nochange
>      DSN=mydsn
>      UID=Admin
>      PWD=******
>
> So when I try to use sqlQuery(channel, "SELECT * Table")
> Returns
> [1] "HY000 0 [Actual][Access] near \"Table\": syntax error"
> [2] "RODBC ERROR: Could not SQLExecDirect 'SELECT * Table'"
>
> Please help me, I'm not familiar with Access at all.

And what ODBC driver are you using?  AFAIK Microsoft does not provide 
one, and the precise SQL syntax needed depends on the driver.

However, this is nothing to do with R, Macs or RODBC. I guess you meant

sqlQuery(channel, "SELECT * from Table")

and need to learn some basic SQL.  (Also, sqlFetch() would appear to do 
this job for you.)

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford



More information about the R-SIG-Mac mailing list