> Can you clarify: are you trying to connect to a mySQL database, or to a 
> sqlite database? 

It is a sqlite database.
Thanks for pointing that out!

Now it works just like in python ;).


con <- dbConnect(SQLite(), dbname="xy.sqlite")

res <- dbSendQuery(conn = con, "SELECT * FROM table1 WHERE x = y")
data <- fetch(res, n = -1)

dbCommit(con)
dbDisconnect(con)


thanks!



On May 16, 2013, at 23:51 , Sarah Goslee <sarah.gos...@gmail.com> wrote:

> Hi Martin,
> 
> Can you clarify: are you trying to connect to a mySQL database, or to a 
> sqlite database? They're not at all the same thing, and I can't tell from 
> your question which you're after. 
> 
> You need either RMySQL, or if you actually want an sqlite database, RSQLite 
> or sqldf.
> 
> Sarah
> 
> On Thursday, May 16, 2013, Martin Batholdy wrote:
> Hi,
> 
> I would like to access a local mysql database.
> 
> In python using the sqlite3 library it is quite straightforward. I just have 
> to pass the path to the sqlite-file;
> sqlite3.connect('.../xy.sqlite')
> 
> Is there something similar in R (or specifically in the RMySQL package)?
> 
> 
> It seems like I have to use the MySQL function in the RMySQL package in order 
> to ...
> "initializes a MySQL client. It returns an driver object that allows you to 
> connect to one or several MySQL servers."
> 
> 
> But is that also possible with a local mySQL database?
> Can't I just provide the information where to find the sqlite file and then 
> open it?
> 
> 
> sorry if this are stupid questions,
> I am not very familiar with databases and just have to access a database on a 
> shared network drive, which worked fine in python but seems to be not so 
> straightforward in R.
> 
> 
> I am grateful for any suggestions!
> 
> 
> 
> 
> -- 
> Sarah Goslee
> http://www.stringpage.com
> http://www.sarahgoslee.com
> http://www.functionaldiversity.org


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to