• No results found

At least one Ubuntu Linux PC

creation and maintenance of MySQL databases

using Calc, the spreadsheet module. This enables access to most common data formats easy-to-use form in

Base, the front end to our database

(fi elds, form layout etc) is carried out from within Base

01

Install LibreOffi ce

At time of writing, the major Linux distributions haven’t moved over to LibreOffi ce 4 and are still offering 3.x. This means that you may have to install LibreOffi ce 4 manually. Visit the LibreOffi ce website (www.libreoffi ce.org) and follow the instructions. On Ubuntu, this consists of unpacking the archive and running

sudo dpkg -i *.deb on the contents.

04

Install the MySQL Server

Type sudo apt-get install mysql-server to begin installation. Before long, you should be prompted to set a root MySQL password. Note this isn’t the same as the administrator account of your system, which is also called ‘root’. Choose a password and make a note of it.

03

Install Java and additional classes

Connectivity between Base and MySQL makes use of a Java class. Type sudo

apt-get install default-jdk to install the

Java runtime. Type sudo apt-get install

libmysql-java to install the needed additional

Java classes.

02

Install the Apache web server

We’ll install Apache early on and with its own command because some of the other packages need to be able to confi gure a working installation. Carry out the installation with sudo apt-get install apache2. Test it by navigating to http://localhost.

05

Install and test phpMyAdmin

Type sudo apt-get install

phpmyadmin to begin installation. When

prompted to choose a web server, choose Apache2, select it with the space bar and press Return. When requested, give it the MySQL root password and then choose a password for phpMyAdmin and make a note of it. Navigating to http://localhost/phpmyadmin/ should take you to a functioning login page. Log in using the MySQL root username and password. We’ll use MySQL to set up and maintain the actual database, although we’ll create the fi elds from within LibreOffi ce later on.

06

Create database

Within the phpMyAdmin web interface, select the Databases tab. Now create a new database by entering the name ‘customer’ into the text box and clicking on Create. This database will contain our customer data.

07

Add JDBC in LibreOffi ce

We now need to tell LibreOffi ce where to fi nd the JDBC class fi le. Start LibreOffi ce and go to LibreOffi ce>Options>Advanced. In the Java Options section, select Class Path and then Add Archive. The fi le you need is located at:/usr/share/java/mysql-connector-java.jar. Select it and restart LibreOffi ce.

08

Connect the database

We now need to connect our front-end (LibreOffi ce) to the back-end (MySQL) of our database. Start LibreOffi ce and launch the Base module. In the dialog that pops up, select ‘Connect to an existing database’. From the drop-down menu below this, select MySQL as the database type.

10

Save the database

You can accept the defaults on the next page, so click on Finish. When prompted, give the database a name and save it. Remember that this fi le contains the connection information for access to our MySQL database – it doesn’t contain the actual records.

12

Create form from template

Select Forms from the sidebar. Click on ‘Use Wizard to Create Form’ in the Tasks window. In the table wizard, click on the >> symbol to copy across all of the fi elds in the database.

13

Finalise form

Accept the defaults in sections 2, 3 and 4, but select the fi rst arrangement icon in section 5, ‘Arrange controls’. You should now see a preview of our entry form in the main window. Select defaults on the other sections and then click on Finish.

14

Test data entry

To enter data into the database, use the form that we created. Select Forms in the sidebar and then double-click on the name of the form in the main window. This brings up the GUI record-editing interface. The form can still be tweaked and edited by right-clicking on its name in the main window.

11

Create fi elds from a template

You may want to create a custom set of fi elds for your customer records, but to save time we’re going to use the one of the templates that is built into Base. Select Tables from the side menu and then ‘Use Wizard to Create Table’. Using the Sample tables pull-down menu, select Customers. Use the >> button to copy all of them across. On the next page, you can tweak the fi elds that you have included and add new ones. Select the defaults on the next two pages and then click on Finish.

09

Confi gure Base

On the next page, select ‘Connect using JDBC’. On the next page, click on ‘Test class’ to ensure that the Java RT is working. Now enter the name of the database that we created, customer, and enter localhost into the Server fi eld. On the next page, add Root as the username and tick ‘Password required’. Now click on the ‘Test connection’ button and enter the root MySQL password, when asked for it, to test the connection between LibreOffi ce and the local MySQL server. Presuming that this completes without errors, click on Next.