RODBC with MAC not working. Using unixODBC and Rstudio
Asked Answered
B

1

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

Barred answered 12/6, 2015 at 21:8 Comment(6)
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).Vacla
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.Barred
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.Vacla
Appreciate the try nrusselBarred
No problem, maybe some more useful information here or hereVacla
You might have better luck asking this on ServerFault also.Vacla
B
0

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

Barred answered 16/6, 2015 at 15:34 Comment(3)
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 takesHagiographa
@user798719, have you had any luck with this without reinstalling? I've posted a question here as well: #40823958Atombomb
Yes it's not sierra necessarily. Use the older version of freetds 091 or whatever the version number is. That fixed the issue.Hagiographa

© 2022 - 2024 — McMap. All rights reserved.