Updated 22 July 02001

Using MySQL with StarOffice, via JDBC

After giving up trying to get StarOffice 5.2 to work with ODBC, I decided to do it the Right Way; using Sun's Java Database Connectivity. It was quite easy to set up.

Configuration

You have to make sure that the correct version of Java is installed, will actually work on the system, and has the correct CLASSPATH set.

You will also need to have the mm.mysql driver from mysql.com in your CLASSPATH.

Java Check

Probably the easiest way to make sure that StarOffice is correctly set up is to try a sample applet in the browser. If this works (in other words, doesn't just appear as a "not found" graphic), you have a working Java installation.

A couple of samples are:

Note for Linux users

Linux StarOffice 5.2 is incredibly picky about what version of the Java Runtime Environment it can use. To the best of my knowledge, the only version that works is 1.1.8 v3, which you can get from blackdown.org, or one of its mirrors.

When you install StarOffice as a user, you'll know if you have a JRE (or JDK -- it's supposed to be happy with that, too) that works if it says Sun Java Runtime Environment 1.1.8 v3 (verified) on the "Choose Java Environment" screen. If it doesn't say "verified", it's unlikely to work.

Java Setup

Select the menu item Tools|Options..., and make sure that the browser settings are set to at least this, modifying your CLASSPATH accordingly:

StarOffice 5.2 browser configuration

If no Java options are enabled, you'll have to un-install and reinstall StarOffice, making sure to:

  1. keep your existing files when you un-install
  2. enabling a verified version of Java when you reinstall.

Creating a new database connection

This example deals with connecting to an existing database, with or without existing tables. Select File|New|Database, and give the database a name:

database created as 'Demo JDBC Test'

Now set the database type to JDBC:

type set to 'JDBC'

Then set the JDBC properties. This is a bit more involved:

JDBC properties

You'll need to make sure that the JDBC driver is set to org.gjt.mm.mysql.Driver and the URL is set to jdbc:mysql://mysqlhost/dbname for the connection to the database dbname on host mysqlhost to be established. It may be helpful to set the user name (and password), and the character set should be set to ANSI to reduce encoding difficulties if you're on an ISO Latin-1 system.

I used to recommend using System for the character encoding -- don't! It messes up the display of high-bit characters.

Be advised that there are full details of the driver syntax and further JDBC options in the mm.mysql distribution. It rewards careful reading.

Now you should be able to choose tables to display. By default, all tables are available for viewing:

JDBC table view

If you click Okay, you'll be in the main database control screen:

StarOffice 5.2 database screen

That's it! You're on your own now. If you make a mess of any data, it's entirely your fault.


Stewart C. Russell <scruss@bigfoot.com>