[R] remote database queries

Cedrick Johnson cedrick at cedrickjohnson.com
Sat Jul 18 23:41:01 CEST 2009


Here's my MYSQL setup for retrieving data:

library(RMySQL)
channel <- dbConnect(MySQL(), user="xxxxxx", password="xxxxxx", 
dbname="HistData", host="nomnom.cvgrllc.com")
EDM1 = dbGetQuery(channel, paste("select Date, o, h, l, c, v, a from 
HistBondData Where Symbol = 'EDM1' AND a != 0 ORDER BY Date ASC"))

Another poster posted something for ODBC which works well for MSSQL 
servers (and could work for mysql, if you have a odbc dsn setup to work 
with mysql)

HTH...

-c



David Lubbers wrote:
> With good and faithful python remote database queries look something
> like this:
>
> url.urlopen("username/pssword at host",query)
>
> where query is something like "select * from table where ...."
>
> Does R support queries on remote hosts with username and password?
>
> What does a simple example look like?
>
> Thank you.
>
> ______________________________________________
> R-help at 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.
>




More information about the R-help mailing list