I usually work with R on a windows querying data through RODBC from a postgresql db on a freebsd machine on my offcie lan. Now I have the chance to use R also on a linux gentoo client box and to connect to the same db. I know that I can install the unixodbc stuff and stick to RODBC, BUT my question is: Is there any more 'linuxish' way of querying a postgresql server from a client? Ciao Vittorio
On Jan 13, 2005, at 6:07 AM, v.demartino2 at virgilio.it wrote:> I usually work with R on a windows querying data through RODBC from a > postgresql > db on a freebsd machine on my offcie lan. > Now I have the chance to use R also on a linux gentoo client box and to > connect to the same db. > I know that I can install the unixodbc stuff and stick to RODBC, BUT > my > question is: > > Is there any more 'linuxish' way of querying a postgresql server from a > client?Use the Rdbi and RdbiPgSQL packages from www.bioconductor.org. You will need to have the postgresql client libraries installed beforehand - the installation of these packages will ask you for the Postgresql library and include paths. Once installed, queries are easy. For example: library(Rdbi) pcon <- dbConnect(PgSQL(),host="myIP", dbname="myDBName",user="me",password="mypasswd") myquery <- paste("select * from mytable") resultDataframe <- dbGetQuery(pcon,myquery) dbDisconnect(pcon)
You can do this in Perl (see e.g. Interchange, using Perl-DBI and TCP-IP instead of sockets). If you're familiar with Perl, that is ...................... Mike -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of v.demartino2 at virgilio.it Sent: 13 January 2005 14:07 To: r-help Subject: [R] R, postgresql, windows & bsd I usually work with R on a windows querying data through RODBC from a postgresql db on a freebsd machine on my offcie lan. Now I have the chance to use R also on a linux gentoo client box and to connect to the same db. I know that I can install the unixodbc stuff and stick to RODBC, BUT my question is: Is there any more 'linuxish' way of querying a postgresql server from a client? Ciao Vittorio ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html