Friday, August 5, 2011

Connect to MySQL database from LibreOffice Base


LibreOffice’s Base program can provide a quick easy way to access a MySQL database and write some reports against data.  The following outlines how to easily setup LibreOffice Base to connect to MySQL.  It assumes that you already have LibreOffice Base installed.  It works just as easily for OpenOffice Base.First we need to install the JDBC driver for MySQL
sudo apt-get install libmysql-java
Next
  1. Open up any LibreOffice program and then click on Tools->Options.
  2. Expand LibreOffice option and then click on Java.
  3. Click on the Class Path button on the right followed by Add Archive.
  4. Browse to /usr/share/java/mysql-connector-java.jar
  5. Click Ok and choose to restart LibreOffice.
  6. Now open LibreOffice Base and choose to Connect to an existing database.
  7. In the drop-down menu choose MySQL, and connect using JDBC.
  8. Click on the Test class button to make sure the JDBC driver loads successfully.  If it doesn’t, then check that you followed the previous steps properly.  If it does load then simply enter the settings as it relates to your MySQL database.
  9. If you get the JDBC driver to load properly, but you cannot connect to your MySQL database,
  10. then I would recommend installing the mysql client and making sure you can connect from the MySQL client first.
  11. If the JDBC driver loads properly, and you can connect to your database with the MySQL database, then you should not have any problem connecting with LibreOffice.

No comments: