Skip to content

Instantly share code, notes, and snippets.

@gregrahn
Created April 14, 2012 06:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregrahn/2382469 to your computer and use it in GitHub Desktop.
Save gregrahn/2382469 to your computer and use it in GitHub Desktop.
example of using R to save query results to csv file
library(RJDBC)
drv <-JDBC("oracle.jdbc.driver.OracleDriver","/Users/grahn/code/jdbc/ojdbc6.jar")
conn<-dbConnect(drv,"jdbc:oracle:thin:@grahn-dev.us.oracle.com:1521:orcl","scott","tiger")
data <-dbGetQuery(conn, "select * from emp")
write.table(data, file="emp.csv", sep = ",", row.names=FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment