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.
On 18/07/2009 3:04 PM, 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?It depends on what kind of database you're connecting to. If you have an ODBC connection set up they're pretty standardized, and it would be something like library(RODBC) channel <- odbcConnect("dsn", uid="username", pwd="password") sqlQuery(channel, query) Duncan Murdoch
That depends on the database, not R. I have done remote database calls using MySQL from R. On Sat, Jul 18, 2009 at 3:04 PM, David Lubbers<lubrs at comcast.net> 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. >
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. >