I have searched for a lot of threads explaining the connexion with a database with R but I still can't make it work.
At the moment, I know that I have to install the package 'ROBDC' and use either odbcConnect()
or odbcDriverConnect()
. But the first one seems harder since I have to set an OBDC connection (tried some things but didn't work too t.t).
My final goal is to extract some data in a database located in a web server but, first, I wanted to see how the functions work for a local database created with Wamp Server. I'm currently working on Windows 7.
My database's name is 'extraction' and the id is 'root' (no pwd, usually) so I wrote :
install.packages('RODBC',repos="http://cran.rstudio.com/")
odbcDriverConnect(Driver='mysql'; Server=localhost;
Database=extraction; Uid='root'; pwd='')
I don't know if the syntax is correct, I have tried a lot and always the same error with drivers and data source unobtainable.
Here the full message (in French sorry D:)
"[RODBC] ERROR: state IM002, code 0, message [Microsoft][Gestionnaire de pilotes ODBC] Source de données introuvable et nom de pilote non spécifié"
I used this function to avoid the dns thing required for obdcConnect()
but still I don't know if I'm doing the right thing (obvsly not since he doesn't work :D) but it's my first time trying with R to interact with databases so I don't know where to go even with all the help I have looked for.
Thanks in advance.
Well, I found a solution with a package called RMySQL