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

Dumblauskas, Jerry jerry.dumblauskas at credit-suisse.com
Fri Aug 28 20:45:54 CEST 2009


So now R can see your odbc ini file -- but at runtime you are still
having issues...

So it should either be:
1) you have a path not set (for the oracle example below I use
LD_LIBRARY_PATH -- not sure about PostGres)
2) your ODBC.ini file doesn't have a line like
Driver = /some_random_path/instantclient_11_1/libsqora.so.11.1 

Send over your odbc.ini entry....

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Oliver Bandel
Sent: Friday, August 28, 2009 1:22 PM
To: r-help at stat.math.ethz.ch
Subject: Re: [R] RODBC: how to set the data-source?

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

______________________________________________
R-help at 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




More information about the R-help mailing list