This document explains how to use Base to edit MySQL Database files using JDBC Connectivity. Base is the Database program in LibreOffice and OpenOffice.
Setting up JDBC
See Installing JDBC for MySQL 5.0 for instructions on how to set-up MySQL and JDBC on Ubuntu.
Connecting via Base
Start up Base and click on "Connect to an existing Database" on the Database Wizard. The connection type should already be selected as "JDBC". Click "Next".
Setting up the Connection
The DataSource URL states where the Database is
This is four parts
- jdbc: specifies that we are going to access the database using Java Database Connectivity. You don't need to type this as it is already there.
mysql: specifies that we are going to connect to a MySql database
- 127.0.0.1 specifies the machine the server is on - this is our own machine "localhost"
emotherearth is the name of the MySql Database we are going to connect to.
The JDBC Driver Class is the Java packaged file that helps us connect to MySql this should be
Click on "Test Class" and you should get a message that the driver has successfully loaded. If not, check the JDBC installation, especially CLASSPATH.
When you set up your MySql server, you set up a user name and password. This is not the same as your ubuntu name and password - it belongs to MySql. You can make the same but it isn't required.
Enter the MySql password and check the "Password required" box
Click on the "Test Connection" button, and enter the password. It should now successfully connect to the database. If not, check your username, password and the Datasource URL.
Registering the Database
Leave "Register the Database for me" as this allows the 'connection' to be saved. If you click "Next" again you will be shown a Save dialog to save the connection details, then the main Base page will appear.
The first time you do something it will ask you to type the password, but other than that it will remember it until you leave LibreOffice or OpenOffice.
The next time
The next time you want to use the file (e.g. after closing Base) you simply open the file you saved in "Registering the Database". You will need to type the password in, but nothing else.