Open Database Connectivity, commonly ODBC, is an open specification for providing application developers with a predictable API with which to access Data Sources

−

−

This document shows how to set up [http://www.unixodbc.org/ unixODBC] in Arch, first to access your database on your localhost and then extends the steps to configure MySQL to allow remote access through ODBC.

−

==MySQL, ODBC with OpenOffice Setup on LocalHost==

−

===Packages To Install===

−

Start by installing the unixodbc and myodbc

−

# pacman -S unixodbc myodbc

−

−

===Configure the ini Files===

−

Configure the "odbc.ini" and "odbcinst.ini" file.

−

Starting with odbcinst.ini, which lists all installed drivers. Su to root and set up your /etc/odbcinst.ini file as follows

−

[MySQL]

−

Description = ODBC Driver for MySQL

−

Driver = /usr/lib/libmyodbc.so

−

Setup = /usr/lib/libodbcmyS.so

−

FileUsage = 1

−

−

Next set up your data sources in "/etc/odbc.ini" (system wide) or "~/.odbc" (current user). If a data source is defined in both of these files, the one in your home directory take precedence.

−

−

[MySQL-test]

−

Description = MySQL database test

−

Driver = MySQL

−

Server = localhost

−

Database = test

−

Port = 3306

−

Socket = /var/run/mysqld/mysqld.sock

−

Option =

−

Stmt =

−

−

===Create A Symbolic Link===

−

Next we need to create a symlink for libmyodbc.so. To do this we need to go to /usr/lib/ and set up a symlink to libmyodbc.so

−

cd /usr/lib/

−

ln -s ./libmyodbc5w.so ./libmyodbc.so

−

−

===Create A Test Database===

−

Create a new database "test". You can use one of the MySQL front-ends {{AUR|mysql-gui-tools}} {{AUR|mysql-workbench}} or the commandline.

−

mysqladmin -h localhost -u root -p create test

−

−

===Testing the ODBC===

−

To test the ODBC connection

−

isql MySQL-test

−

−

If the connection is established, you will see

−

+---------------------------------------+

−

| Connected! |

−

| |

−

| sql-statement |

−

| help [tablename] |

−

| quit |

−

| |

−

+---------------------------------------+

−

SQL>

−

−

If you have a problem connecting then check the error message by running

−

isql MySQL-test -v

−

−

===A Couple Useful Websites===

−

http://www.unixodbc.org/doc/OOoMySQL.pdf

−

−

This website got me going on ODBC with MySQL but left out some things that were necessary for me

−

to get isql up and running. However this might be a good reference for the OpenOffice part.