Question

I'm trying to connect to the server through the SQLite package but can't find the right spelling of database credentials anywhere. Actually I have MySQL and PostgreSQL bases on the server and I found a way to connect to a PostgreSQL it sounds like this:

drv <- dbDriver('PostgreSQL')
con <- dbConnect(drv, dbname='...', user='...',
password='...', host='...', port=...)

but if I change the driver to ('SQLite') and the database credentials, it shows me:

Error in sqliteNewConnection(drv, ...) :
unused arguments (user = ......blablabla

Does anybody knows what the right arguments for MySQL database connection are?

Was it helpful?

Solution

Looks like you are mixing things up here. You'll need RMySQL to connect to a MySQL database. MySQL is Oracle's light (and free) version of a relational DBMS. SQLite is something different. That being said, if you got the choice, go with PostgreSQL if it's meant to stay, otherwise SQLite might be ok for some testing. R and PostgreSQL really work well together.

Ah, and note that there was NO windows binary of RMySQL on CRAN when I wrote this. SO if you are on Windows and want to use R with MySQL you gotta compile the package. With the right R setup it should just be a matter of install.packages('RMySQL',type='source').

If you are not ready to compile on your own RODBC might also work for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top