When I tried to connect R with Access database I get an error
odbcConnectAccess is only usable with 32-bit Windows
Does anyone has an idea how to solve this?
library(RODBC)
mdbConnect<-odbcConnectAccess("D:/SampleDB1/sampleDB1.mdb")
When I tried to connect R with Access database I get an error
odbcConnectAccess is only usable with 32-bit Windows
Does anyone has an idea how to solve this?
library(RODBC)
mdbConnect<-odbcConnectAccess("D:/SampleDB1/sampleDB1.mdb")
The function by manotheshark above is very useful, but I wanted to use an SQL query, rather than a table name, to access the database and also to pass the database name as a parameter since I commonly work with a number of Access databases. Here is a modified version:
I also had some difficulty working out how to call manotheshark's function and it took some delving into the svSocket package documentation to realise that the calling script needs to instantiate the object in which the data will be returned and then to pass its NAME (not the object itself) in the table_out parameter. Here is an example of an R-script that calls my modified version:
This works, but has limitations.
Firstly, avoid any Microsoft Access SQL extensions. For example, if you use the Access Query builder, it will often insert field names like
[TABLE_NAME]![FIELD_NAME]
. These will not work. Also Access allows non-standard field names that start with a digit like "10kmSq" and allows you to use them in SQL likeSELECT [10kmSq] FROM ...
. This also won't work. If there is an error in the SQL syntax, the return variable will contain an error message.Secondly, the amount of data you can return appears to be limited to 64Kb. If you try to run SQL that returns too much, the 32-bit session does not terminate and the script hangs.