简体   繁体   中英

Connection to MS SQL server with RODBC from mac osx 10.11

I have downloaded and configured freeTDS and unixODBC as proof I have connected with tsql and isql. When I download RODBC from RStudio and try and connect with mssql server I get the following error

[RODBC] ERROR: state IM002, code 1606386064, message [iODBC][Driver Manager]
Data source name not found and no default driver specified. Driver could not be loaded

From the error I note that iODBC is still being used instead of unixODBC. I then uninstall RODBC from RStudio and go to terminal to try and force RODBC to install using unixODBC by using

export DYLD_LIBRARY_PATH=/usr/local/lib:${DYLD_LIBRARY_PATH}
R CMD INSTALL /Users/<username>/Downloads/RODBC_1.3-13.tar.gz

So the computer knows to install in the location of unixODBC.

I get the same error as above. I am not sure if I am doing something wrong or if there is another way to make R use unixODBC?

I am also open to a suggestion on how to make iODBC to work. I am new at this whole connecting to servers business.

For OS 10.13.3, I got r RODBC and python pymssql working with MS SQL using the following commands:

brew install homebrew/core/freetds091 --with-unixodbc.  
brew link --force freetds@0.91  
pip install pymssql  

and then making the following edits to /Users//.odbc.ini

[SQLServer]   
Description = "my server"  
Driver = /usr/local/lib/libtdsodbc.so  
Trace=No  
Server = "my server"  
Port=1433   
TDS_Version=8.0  
Database= "my db"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM