OK Is your PostGres server on the same Linux box you are running R on? Sample values Server = 169.49.30.69 (localhost host means you are on the same box) Port = 2700 (make sure your port is correct)
Also, I am not seeing your id and password.... I use the signature CONNREAD <- odbcConnect(READDBID, uid = READDBUSER, pwd = READDBPWD, believeNRows=FALSE) So for you this would be channel <- odbcConnect("rtestdb", uid="rtest", pwd="???", believeNRows=FALSE) The alloc error means you are close... Make sure you can connect to your DB outside of R as well.... hth -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Oliver Bandel Sent: Friday, August 28, 2009 2:22 PM To: r-h...@stat.math.ethz.ch Subject: Re: [R] RODBC: how to set the data-source? Hi, in /usr/share/doc/r-cran-rodbc/README.gz I found this example: ============== [testpg] Description = testpg Driver = PostgreSQL Trace = No TraceFile = ServerName = localhost UserName = ripley Port = 5432 Socket = Database = testdb ReadOnly = 0 ============== I changed it for me to: ============== [rtest] Description = rtest Driver = PostgreSQL Trace = No TraceFile = ServerName = localhost UserName = oliver Port = 5432 Socket = Database = rtest ReadOnly = 0 ============== With your hint on the Driver-value: ============== [rtest] Description = rtest Driver = /usr/lib/odbc/libodbcpsqlS.so Trace = No TraceFile = ServerName = localhost UserName = oliver Port = 5432 Socket = Database = rtest ReadOnly = 0 ============== Maybe I should give different names for the section and the database?! ============== [rtestdb] Description = rtest Driver = /usr/lib/odbc/libodbcpsqlS.so Trace = No TraceFile = ServerName = localhost UserName = oliver Port = 5432 Socket = Database = rtest ReadOnly = 0 ============== x > channel <- odbcConnect("rtestdb", "rtest") x Warning messages: x 1: In odbcDriverConnect(st, ...) : x [RODBC] ERROR: state IM004, code 0, message [unixODBC][Driver x x Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed x 2: In odbcDriverConnect(st, ...) : ODBC connection failed So this is not working correctly. Here my settings for the ENV-vars: oli...@siouxsie:~$ echo $ODBCINI /etc/odbc.ini oli...@siouxsie:~$ echo $ODBCSYSINI /etc/ oli...@siouxsie:~$ echo $LD_LIBRARY_PATH /usr/lib/odbc/libodbcpsqlS.so oli...@siouxsie:~$ I have no clue what's the problem now. Oliver ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. =============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.