[R] RODBC: how to set the data-source?

Oliver Bandel oliver at first.in-berlin.de
Fri Aug 28 20:21:52 CEST 2009


Dumblauskas, Jerry <jerry.dumblauskas <at> credit-suisse.com> writes:

> 
> Looks like Unix....


...well, near by: Linux.


> 
> If so, make sure your script has the proper paths set
> 
> Here is my set up for an oracle DB
> 
> export LD_LIBRARY_PATH=/../../instantclient_11_1:/../../unixODBC64_1/lib
> export ODBCINI=/../..//unixODBC64_1
> export ODBCSYSINI=/../..//unixODBC64_1 
> 
> And of course you need your db defined in ODBC.ini and this will link to
> your driver code...


OK, this was a good hint.

After looking around for that ODBC-configuration stuff I also found:
  /usr/share/doc/r-cran-rodbc/README.gz

There is an example-config mentioned, which I changed to my needs.

Now I get a result from odbcDataSources() but can't connect to the db:

x    > library(RODBC)
x    > odbcDataSources()
x           rtest 
x    "PostgreSQL" 
x    > channel <- odbcConnect("rtest")
x    Warning messages:
x    1: In odbcDriverConnect(st, ...) :
x      [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver     
x    Manager]Data source name not found, and no default driver specified
x    2: In odbcDriverConnect(st, ...) : ODBC connection failed
x    > channel <- odbcConnect("PostgreSQL", "rtest")
x    Warning messages:
x    1: In odbcDriverConnect(st, ...) :
x      [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver 
x    Manager]Data source name not found, and no default driver specified
x    2: In odbcDriverConnect(st, ...) : ODBC connection failed
x    > 


Any further ideas?


Oliver




More information about the R-help mailing list