Adding An ODBC Driver For MySQL On Ubuntu

De Wiki do Bernardino
Ir para: navegação, pesquisa

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


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/ For "Setup file name" choose /usr/lib/odbc/

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:


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

That's it.