Virtual OS/2 International Consumer Education
VOICE Home Page: http://www.os2voice.org
May 2004

Newsletter Index
< Previous Page | Next Page >
Feature Index

editor@os2voice.org


Access to MySQL databases from StarOffice via JDBC

By Wolfgang Draxler © May 2004

The question is often asked in newsgroups how to use MySQL with StarOffice. I briefly describe how to do this using the database mentioned in the article "Close Collaboration between MySQL and OS/2."

At present there is only one way to make the connection, namely via JDBC. Java 1.1.8 must be installed (later versions do not work). Theoretically, an ODBC component should also work but unfortunately there is no OS/2 driver available. Perhaps some programmer will write one.

Now back to the JDBC driver. Download the ZIP file mysql-connector-java-2.0.14.zip by following the link http://dev.mysql.com/downloads/connector/j/2.0.html to the ZIP archive. Place the archive in its own directory.

Unzipping this archive produces a lot of files and directories. Look for the file mysql-connector-java-2.0.14-bin.jar and copy it into its own directory; I chose f:\java\jar. Rename the file to mysql.jar. (I did this only because the new name is shorter and easier to type. And it makes it easy to change to other versions.)

Now go to the installation directory of StarOffice which in my case is f:\textmanagement\staroffice51. Find the file soffice.ini and make a backup copy. Open the file with a text editor, e.g. e.exe.

Find the section headed [JAVA], change the entries as follows:

[Java]
Home=d:\java11
Version=1.1.8
RuntimeLib=d:\java11\dll\javai.dll
SystemClasspath=.\.;d:\java11\swing\swingall.jar;d:\java11\lib\secma.jar;d:\java11\icatjava\daemon\javaprob.zip;d:\java11\lib\classes.zip;d:\java11\lib\comm.jar;
Java=1
UserClassPath=f:\java\jar\mysql.jar
NetAccess=HOST
Security=1

(In my case, eComStation is installed on drive D:. Java 1.1.8 is also stored on D:.)

Now save the file and start StarOffice 5.1a. When it is running, click on the Tools menu and then on Options. There will be a menu tree on the left. Choose Browser and then Other. In the text-entry field on the right, next to ClassPath, enter the text f:\java\jar\mysql.jar. Then click OK.

Options
Fig.1: StarOffice Options

Now click the menu entries File->New->Database. A dialog appears where the database connection can be configured.

db connect
Fig.2: Database properties

On the General tab you supply the name of the database connection. This 'name' is needed by StarOffice and has nothing to do with MySQL. I entered "Adressen."

Next click on Type and for Database type enter the value JDBC.

db type
Fig.3: Setting the database connection type

Now click on the JDBC tab and enter the following:

JDBC-driver-class: com.mysql.jdbc.Driver
URL: jdbc:mysql://127.0.0.1/adresses
Username: root
Password: <your root password>

When all this has been entered correctly, under the Tables tab you can view a list of all the tables stored in the given database in MySQL; e.g. in our case the table "land."

db tables
Fig.4: List of the configured tables

. . . and finally click on the OK button. You are done!


We heartily thank Timo Maier for permission to copy part of the website http://tam.belchenstuermer.de/tipps/jdbc/.

References:

JDBC-Treiber: http://dev.mysql.com/downloads /connector/j/2.0.html
Tips-Seite zu JDBC/MySQL/StarOffice: http://tam.belchenstuermer.de/tipps/jdbc/


Wolfgang Draxler lebt mit seiner Ehefrau Yvonne in Wien. Er ist für eine Softwareentwicklungs- und Beratungsfirma im Bereich der Organisations- und Datenbankprogrammierung tätig. Privat arbeitet er unter anderem an der Weiterentwicklung von Sibyl für OS/2, einer Delphi-ähnlichen Programmiersprache.

Feature Index
editor@os2voice.org
< Previous Page | Newsletter Index | Next Page >
VOICE Home Page: http://www.os2voice.org