## create a Oracle instance and create one connection.
m <- dbManager("Oracle")
con <- dbConnect(m, user = "opto", password="pure-light", db="oras")
## you can also use Oracle's user/password@dbname convention
con2 <- dbConnect(m, user = "opto/pure-light@oras")
## or if you have defined the ORACLE_SID shell variable
con3 <- dbConnect(m, user = "opto", password = "pure-light")
## clone an existing connection
w <- dbConnect(con)
## execute a statement and fetch its output in chunks of no more
## than 5000 rows at a time
rs <- dbExec(con, "select * from HTTP_ACCESS where IP_ADDRESS = '127.0.0.1'")
while(!hasCompleted(rs)){
df <- fetch(rs, n = 5000)
process(df)
}
hasCompleted(rs)
[1] TRUE
close(rs) ## done with this query
close(con) ## done with this connection
Run the code above in your browser using DataLab