Thursday, June 04, 2009

RJDBC connect Oracle

library(RJDBC)

# point the R package at the appropriate java driver class, as well as the class file
drv<-JDBC(”oracle.jdbc.driver.OracleDriver”, “/location/of/ojdbc14.jar”)
# the “easy” connection string spec for oracle db’s
conn<-dbConnect(drv, “jdbc:oracle:thin:@<host>:<port default=1521>:<SID>”,”username”,”password”)

# etc…
query = “SELECT * FROM A TABLE”
dbGetQuery(conn, query)

No comments: