hey all, I feel like I must be missing something rather plain, but I don't get it. how is one supposed to use R as a PgSQL client on Windows? Assume my windows desktop is on the same network as a PgSQL server, and I just need to use R to connect and pull down some data. The thing that is confusing me is that RODBC doesn't seem to know anything about PgSQL, in that odbcDataSources(type = "all") only returns info about MS/Excell/Access/dBase stuff. What does it take to get RODBC to deal with PgSQL? thanks, mike -- View this message in context: http://www.nabble.com/Connecting-R-to-PostgreSQL-via-RODBC%2C-on-Windows-tf4525842.html#a12913078 Sent from the R help mailing list archive at Nabble.com.
elw at stderr.org
2007-Sep-27 01:24 UTC
[R] Connecting R to PostgreSQL via RODBC, on Windows
> I feel like I must be missing something rather plain, but I don't get > it. how is one supposed to use R as a PgSQL client on Windows? Assume > my windows desktop is on the same network as a PgSQL server, and I just > need to use R to connect and pull down some data. > > The thing that is confusing me is that RODBC doesn't seem to know > anything about PgSQL, in that odbcDataSources(type = "all") only returns > info about MS/Excell/Access/dBase stuff. What does it take to get RODBC > to deal with PgSQL?There's an odbc-to-pgsql driver for windows that will need to be installed. You can find that here: http://www.postgresql.org/ftp/odbc/versions/ Then, you set up your connection to postgresql via the Control Panel, under Administrative Tools, then Data Sources. Then connect to that with R. [I have mostly done this under Linux - it has been quite a while since I've needed to do it on Windows, but this is a broadly correct outline of the necessary steps.] --e
Prof Brian Ripley
2007-Sep-27 05:54 UTC
[R] Connecting R to PostgreSQL via RODBC, on Windows
On Wed, 26 Sep 2007, mfrumin wrote:> > hey all, > > I feel like I must be missing something rather plain, but I don't get it. > how is one supposed to use R as a PgSQL client on Windows? Assume my > windows desktop is on the same network as a PgSQL server, and I just need to > use R to connect and pull down some data. > > The thing that is confusing me is that RODBC doesn't seem to know anything > about PgSQL, in that odbcDataSources(type = "all") only returns info about > MS/Excell/Access/dBase stuff. What does it take to get RODBC to deal with > PgSQL?This is an ODBC (not RODBC) issue. You need to install the PostgreSQL ODBC driver and use the 'Data Sources' applet in the Control Panel to set it up. Talk to your sysadmin about how (s)he installed PostgreSQL (or read the PostgreSQL documentation) if you need more help. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595