Me and U(buntu)

My Ubuntu Experience!

OpenOffice, JDBC and MySQL

Posted by ushimitsudoki on December 4, 2008

Today I wanted to connect OpenOffice.org 3.0 Base to my local MySQL server for some doodling – basically I want to see if Base is ready for normal use. Getting it hooked up is slightly tricky, because I kept getting a “The JDBC driver could not be loaded.” error.

Right. So just trying to connect to the MySQL server via JDBC by default kept giving me this:

Big fat JDBC Error

Big fat JDBC Error

This boils down to one of two things:

  1. You do not have the driver installed, or
  2. The driver is installed but can not be found

Check the driver installation

The file we are looking for: /usr/share/java/mysql.jar

If it is not there then install it:

sudo apt-get install libmysql-java

(You could just install it if you are too lazy to check it.)

Make it find-able

There are some guides to adjusting your CLASSPATH to put /usr/share/java/mysql.jar in your environment, but this does not seem to work for me and OpenOffice.

Fortunately, there is an easy way in OpenOffice. Launch OpenOffice and GUI your way to:
Tools > Options > Java > Class Path > Add Archive

And, then use the file dialog to add: /usr/share/java/mysql.jar:

Here it is added.

Here it is added.

You may have to re-start OpenOffice.

Test!

Now, when you test the driver, you should see “The JDBC driver was loaded successfully.”

Success! JDBC driver loaded!

Success! JDBC driver loaded!

Now to see how it works out!

3 Responses to “OpenOffice, JDBC and MySQL”

  1. giuseppe said

    I wish to point out an article about Java and Openoffice base database (hsqldb).
    It explain how can read, edit, and write data into openoffice base db with java.
    I hope it is welcome.

  2. David said

    This worked great. Thanks for the help!

  3. Luca said

    Thank you very much. It’s the right solution for my issue. Have a nice life.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>