Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A few preliminaries -

OS: Fedora release 16 (Verne)

MySQL server version: 5.5.29 MySQL Community Server

R version: 2.15.1 (2012-06-22) -- "Roasted Marshmallows"

I am running a MySQL server that is hosted at localhost (

I have R scripts that use the RODBC library and would like to be able to pass a Data Source Name (DSN) to the odbcConnect() function of ODBC.

After some Googling (there are a few pages that deal with MS SQL Server DSNs with RODBC on a Linux OS), I am of the opinion that I need to populate the configuration file at /etc/odbc.ini . Currently, here are the file contents:

[ODBC Data Sources]

Description = my Data Source Name
Driver = MySQL
UID = root
PWD = *password*
Port = 3306
Database = my_database

I also read that the Driver value in the above file points to /etc/odbcinst.ini . Here are its contents:

Description = ODBC for MySQL
Driver = /usr/lib/
Setup = /usr/lib/
Driver64 = /usr/lib64/
Setup64 = /usr/lib64/
FileUsage = 1

Yet, when I run R, I receive an error message.

> library(RODBC)
> cn <- odbcConnect('myDSN')
Warning messages:
1: In odbcDriverConnect("DSN=myDSN") :
[RODBC] ERROR: state 01000, code 0, message [unixODBC][Driver Manager]Can't open lib '/usr/lib/' : file not found
2: In odbcDriverConnect("DSN=myDSN") : ODBC connection failed

I have verified that the file /usr/lib/ exists. It is actually a link to /usr/lib/; I've tried replacing this file name in Driver line of /etc/odbcinst.ini but receive the same error from R.

How can I make this work while still using RODBC?


I removed what I had manually added to /etc/odbcinst.ini and then proceeded with the following steps.

I tried to install mysql-connector-odbc, but was told that it was already installed. So I stopped my MySQL server, removed the mysql-connector-odbc package with sudo yum remove mysql-connector-odbc, re-installed the mysql-connector-odbc package, and started the MySQL server.

When I tried to run the same R commands as above, I received the same results.

share|improve this question

I was able to reproduce your issue on CentOS 6.3. After that, I installed the mysql-connector-odbc package: yum install mysql-connector-odbc and it was then able to connect to the MySQL database. First, remove what you have manually added to /etc/odbcinst.ini and then install mysql-connector-odbc, which will update /etc/odbcinst.ini for you. Give that a shot and run your script again, then let us know if the issue is still occurring.

Also, it sounds like there are some incompatible packages installed. If you have any that start with MySQL- (from (check with rpm -qa | grep -i mysql), remove them and install those that are part of the standard distributions yum repositories. You may need to just remove them all and then install what you need.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .