# NOT RUN {
# create a PostgreSQL instance and create one connection.
> m <- dbDriver("PostgreSQL")
<PostgreSQLDriver:(4378)>
> con <- dbConnect(m, user="username", password="passwd", dbname="database_name")
> rs <- dbSendQuery(con, "select * sales where price < 10")
> df <- fetch(rs, n = 50)
> dbHasCompleted(rs)
[1] FALSE
> df2 <- fetch(rs, n = -1)
> dbHasCompleted(rs)
[1] TRUE
> dbClearResult(rs)
> dbListTables(con)
# }
Run the code above in your browser using DataLab