Adding An ODBC Driver For MySQL On Ubuntu

Sometimes you may find the need to develop cross platform applications which make use of a database. ODBC can be a solution to your portability needs, but unfortunately it is not as easy to set up an ODBC connection on Linux as it is on Windows. This tutorial attempts to shed some light on this process by guiding you towards adding an ODBC driver on Ubuntu. The process described below has been tested on Ubuntu 8.04 and Ubuntu 8.10.

 

1. Install iodbc - GTK+ config frontend for the iODBC Driver Manager

sudo apt-get install iodbc

 

2. Install mysql connector for odbc

sudo apt-get install libmyodbc

 

3. Start iodbc

iodbcadm-gtk

 

4. Add the mysql driver to the list of ODBC drivers

Switch to the "ODBC Drivers" tab, click "Add a driver". Type in a description of the driver (i.e., "MySQL").

For "Driver file name" choose /usr/lib/odbc/libmyodbc.so.
For "Setup file name" choose /usr/lib/odbc/libodbcmyS.so.

This setup file appears to be supplied by unixodbc, which I already had installed.

 

5. Create a new User DSN (the procedure is the same for System DSN)

Click "Add", select the already created MySQL ODBC driver.

Give a name to your datasource (i.e.,"bobs_mysqldb").

You will now have to add a few keywords based on your server configuration. Minimally you should have:

    server
    database
    user
    password

The complete list of available keywords is documented on the MySQL connector page.

That's it.

Share this page:

3 Comment(s)

Add comment

Comments

From: Lutfi

On my Hardy, it's cannot start using "iodbcadm-gtk". But using "sudo iodbcadm-gtk" can running.

From: Glenn

The odbc client closes everytime I click on the "Driver Tab" :(

From: Jordan

There is an alternative driver connection instruction to install and customize MySQL odbc driver https://www.devart.com/odbc/mysql/docs/index.html