Skip to content
Prev 454 / 1559 Next

R and Postgres

Hi

I run postgre 8.3 on linux and can access it, ive put a generic example 
of how I got it to work below, ive only used it for a database on a 
local machine.

Hope it gives you a start :)

#########

library(Rdbi)
library(RdbiPgSQL)

#establish connection
conn <- dbConnect(PgSQL(),host='host',dbname='mydatabasename',user='me')

#send query
query <- dbSendQuery(conn,"select * from my table")

#get results
results <- dbGetResult(query)

#close connection
dbDisconnect(conn)

################
Sebastian P. Luque wrote: