I can't find a way around this error when trying to connect to ODBC (either via the console or via the Connections tab:
I get that error message when running:
con <- DBI::dbConnect(odbc::odbc(),
driver = "MySQL"
)
As far as I can tell, my odbc.ini is in the right place, the ODBC package can find it, and it has the correct information (as illustrated in the following code).
> odbcListDrivers()
name attribute value
1 SQLite Driver /usr/local/lib/libsqlite3odbc.dylib
2 PostgreSQL Driver /usr/local/lib/psqlodbcw.so
3 MySQL Driver /usr/local/lib/libmysqlclient.dylib
4 MariaSQL Driver /usr/local/lib/libmaodbc.dylib
5 SQL Server Driver /usr/local/lib/libtdsodbc.so
and:
> odbcListDataSources()
name description
1 SDB_STAT
2 MySQL-test MySQL
This code, with the same parameters but with the MySQL package, works fine:
con <- dbConnect(
MySQL(),
user = Sys.getenv("SDB_USER"),
password = Sys.getenv("SDB_PASSWORD"),
dbname = dbname,
host = "xxx.xxx.xxx.xxx", port = 3306
)
So I know the MySQL database is there and that I have the right connections parameters. I just would really like to use the Connections tab (and ODBC is alleged to be the path of least resistance).
I've hunted around the web including this excellent page from RStudio: Troubleshooting Connections and unixODBC without the GUI.
I'm about to try to UN-install ODBC completely (although I'm concerned about leaving some trace that might be what's actually causing the problem.
Can anybody help me?