My working laptop is Mac OS X 10.11.3 El Capitan. I am currently working on a project in which I am developing a shiny app to visualize the data in our company's MySQL database. I set up the SSH Tunnel via 'SSH Tunnel Manager' and was able to connect MySQL data via SquelPro. However, I am constantly having problems when I am trying to connect MySQL data in R (R-version3.2.3 / Rstduio-version 0.99.491) using 'RODBC' package.
Initially, I am following this blog: http://blog.nguyenvq.com/blog/2013/04/06/guide-to-accessing-ms-sql-server-and-mysql-server-on-mac-os-x/ to downloaded and created the connector and 'odbc.ini' files. Then move them to the right locations.
Yet, when I try to install package 'RODBC' in R, the installation process fails and returns the following error message - "configure: error: "ODBC headers sql.h and sqlext.h not found". Then I follow the steps in this link to downloaded the iODBC zip files: Installation of RODBC/ROracle packages on OS X Mavericks Yet, I couldn't identify the file 'libiodbc.a' in the archball. So, just moving the sql.h and sqlext.h files are not helping. I still have that issue.
So, I found another link: Installation of RODBC on OS X Yosemite which says installing unixODBC will also solve this issue. So I copied the commands and successfully downloaded unixODBC. This time it works. I successfully called the library(RODBC) in R. However, when I run the following R commands in Rstudio:
connect1 <- odbcConnect(dsn="mysql01",
uid="user_name",
pwd="pass_words")
Then I got error message like:
Warning messages:
1: In odbcDriverConnect("DSN=mysql01;UID=user_name;PWD=pass_words") :
[RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data source name not found, and no default driver specified
2: In odbcDriverConnect("DSN=mysql01;UID=user_name;PWD=pass_words") :
ODBC connection failed
It seems that I need to configure the driver manager for unixODBC on R. However, I am not sure what exactly gone wrong in the process above. What should I do next to get R connected to MySQL?