Connecting to an MSSQL Server (and others) with OpenOffice.org
I have wanted to try out OpenOffice.org Base for some time now, but I have never taken the time to figure out how to make it connect to a relational database system. And as it turns out there doesn't seem to be all that much documentation to help. Anyway I needed to figure out a way to look over the structure of a Microsoft SQL database and I didn't have access to a Windows machine, let alone Enterprise Manager.
So OpenOffice.org uses JDBC to connect to various databases, but sadly it does not come bundled with any of the libraries required to connect and communicate. So after researching a little I came across jTDS. And with a little messing around I got it to work. Below is what I did.
- First you have to download jTDS at http://sourceforge.net/project/showfiles.php?group_id=33291.
- Second, uncompress the file and store it somewhere out of the way on your computer (such that you don't accidentally move or delete it). You can store the whole folder or just the jtds-x.x.x.jar file.
open up OpenOffice.org and go to Tools, Options..., OpenOffice.org (or NeoOffice), Java and then click on Class Path... and then Add Archive...(EDIT: Seems the options menu has changed) open up LibreOffice (OpenOffice.org) Tools, Options..., LibreOffice, Advanced, Class Path..., Add Archive.... Choose the jtds-x.x.x.jar file and hit Open. Then keep hitting Ok until all preference windows are closed.
- Fourth, you need to close and reopen OpenOffice.org for the change to take effect.
- Fifth, open up Base and when the wizard comes up choose Connect to an existing database, choose JDBC from the dropdown and then hit Next.
Sixth, the Datasource URL is of the form below.
Replace [host] with the hostname of the server, replace [port] with the port that the database connects over (the default is usually 1433) and replace [database] with the name of the database.
Seventh, for the JDBC driver class put in the below.
You can hit Test class if you want to. It should give you a promising message. After all of the fields are filled out hit Next.
- Eight, on this screen you can fill out the authentication information. This should be pretty straight forward and you can test it to see that it is connecting properly. And then on the last screen you can set some final options and then save the local connected copy somewhere.
After that you should be able to see and browse the tables, build queries and have fun.
- - - - -
You can also use this jTDS driver to connect to Sybase. All you have to change the Datasource URL to this form.
- - - - -
For connecting to MySQL you can follow these same steps except you need to get the MySQL JDBC driver class from the MySQL website (http://www.mysql.com/products/connector/j).
The Datasource URL is:
And the JDBC driver class is: