[R] R connectivity with Oracle DB

Franzini, Gabriele [Nervianoms] Gabriele.Franzini at nervianoms.com
Fri May 29 12:24:22 CEST 2009


Hello Madan, 
I am rather novice as well, so I went the ODBC way. 
If you define an ODBC connection to Oracle, with System DSN dsn-name,
the code to get the results of a query into, say, mydata is like :

library(RODBC) # First of all
channel <- odbcConnect("dsn-name", uid="someuser") # double quotes
required, it will ask for the password
# Return rows from an SQL query
mydata <- sqlQuery (channel, "Select .... put your query here ...") #
same as before
odbcClose(channel) # When you're done

HTH,
Gabriele Franzini 
ICT Applications Manager 
Nerviano Medical Sciences SRL 
Nerviano Italy 




More information about the R-help mailing list