6

I followed this guide http://eriqande.github.io/2014/12/19/setting-up-rodbc.html to get RODBC working with MAC and I am able to connect to the DB.

Marcos-MacBook-Pro:~ MarcoB$ isql -v ODBC_SQLSS_R **** ******  
+---------------------------------------+  
| Connected!                            |  
|                                       |    
| sql-statement                         |  
| help [tablename]                      |  
| quit                                  |   
|                                       |  
+---------------------------------------+  
SQL> 

The configuration files are set according to the guide.

Marcos-MacBook-Pro:~ MarcoB$ cat /usr/local/etc/freetds.conf 
[ODBC_SQLSS_R]    
host = xxx.xxx.xxx.xxx    
port = 1433    
client charset = UTF-8



Marcos-MacBook-Pro:~ MarcoB$ cat /usr/local/etc/odbc.ini   
[ODBC_SQLSS_R]  
Driver = /usr/local/lib/libtdsodbc.so  
Server = xxx.xxx.xxx.xxx
POrt = 1433

I install the RODBC package

> install.packages("RODBC", type = "source")  
...
** R  
** inst  
** preparing package for lazy loading  
** help  
*** installing help indices  
** building package indices  
** installing vignettes  
** testing if installed package can be loaded  
* DONE (RODBC)  

And when I try it out it seems that it does not use my UnixODBC libraries.

 library("RODBC")
 odbcDataSources()
 named character(0)

When I try to connect via ODBC

    odbcConnect("ODBC_SQLSS_R", uid=“*****", pwd=“******");   
    Warning messages:  
    1: In odbcDriverConnect("DSN=ODBC_SQLSS_R;UID=*****;PWD=*****") :  
      [RODBC] ERROR: state IM002, code 1962223636, message [iODBC][Driver 
  Manager]Data   source name not found and no default driver specified. 
 Driver could   not be loaded    

The error message indicates to me that RODBC is still using iODBC. I browsed the internet for days now but I can't find a solution for the problem. Would be really amazing if anybody here could point me in the right direction.

Marco

  • What does your `odbcinst.ini` file look like? I think you need something to the effect of `[ODBC Drivers] \ freetds=installed \ [freetds] \ driver = /usr/local/lib/libtdsodbc.so \ setup = /usr/local/lib/libtdsodbc.so` (where the `\\` should actually be line breaks). – nrussell Jun 12 '15 at 21:22
  • odbcinst.ini was completely empty I did edit it now with your values and reinstalled RODBC but I get the same odbcDataSources() named character(0) after. – Marco Blume Jun 13 '15 at 01:43
  • I'm not sure about on OS X but on Linux distributions I've needed to configure that file as well otherwise I have issues with isql / ODBC connections. – nrussell Jun 13 '15 at 01:45
  • Appreciate the try nrussel – Marco Blume Jun 13 '15 at 01:48
  • No problem, maybe some more useful information [here](http://www.unixodbc.org/odbcinst.html) or [here](https://gist.github.com/Bouke/10454272) – nrussell Jun 13 '15 at 01:52
  • You might have better luck asking this on ServerFault also. – nrussell Jun 13 '15 at 02:26

1 Answers1

0

A clean reinstall of my Mac seem to have solved the library issues. I just followed the guide exactly again and it worked.

  • there is a serious problem with RODBC and mac sierra. Can't get it to work no matter what. I hope a clean reinstall is not what it takes – user798719 Nov 15 '16 at 08:01
  • @user798719, have you had any luck with this without reinstalling? I've posted a question here as well: http://stackoverflow.com/questions/40823458/odbc-data-source-name-not-found-and-no-default-driver-specified – Bobby Nov 26 '16 at 21:53
  • Yes it's not sierra necessarily. Use the older version of freetds 091 or whatever the version number is. That fixed the issue. – user798719 Nov 27 '16 at 01:50