From Fedora Project Wiki

Revision as of 07:37, 22 April 2013 by Hhorak (talk | contribs) (Created page with "This test case uses libreoffice-base package to test functionality of MySQL or MariaDB. == Prerequisites == For this test we need to have installed mysql-connector-java and ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This test case uses libreoffice-base package to test functionality of MySQL or MariaDB.

Prerequisites

For this test we need to have installed mysql-connector-java and libreoffice-base packages. In order to test Fedora 19 package of mysql-connector-java in F18, use a build from the test day testing repository, i.e. use --enablerepo=mariadb-testday argument in yum command.

# yum install mysql-connector-java libreoffice-base

Setting up a connection to MySQL or MariaDB in libreoffice-base

Start mysqld daemon:

# systemctl start mysqld

Prepare testing user and database

This will create a testing database mariadbtestday and user maria with password passwd. Off course you can use existing database and/or user alternatively.

# mysql 
mysql> CREATE DATABASE mariadbtestday;
mysql> CREATE USER 'maria'@'localhost' IDENTIFIED BY 'passwd';
mysql> GRANT ALL PRIVILEGES ON mariadbtestday.* TO 'maria'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> QUIT;

Create a connection to MySQL or MariaDB in libreoffice-base

Start libreoffice-base and on the welcome screen:

  • select Connect to an existing database
  • select JDBC
  • click Next

On the next screen add the following data:

  • Datasource URL: mysql://localhost:3306/test
  • JDBC Driver class: com.mysql.jdbc.Driver

On the next screen enter username (maria) and set that we require a password.

Save the database settings to a file.

Setting classpath to the mysql connector

At this time mysql connector is not ready yet. We need to properly set classpath to the connector jar file.

In Base goto Tools/Options/Java, click Classpath and select /usr/share/java/mysql-connector-java.jar in the file browser.

Then restart libreoffice base.

In the welcome screen select Open an existing database file and select stored database settings.

Play with libreoffice-base

Now you should have working connection to MySQL or MariaDB database.

Click on tables and set password after you are prompted.

Feel free to perform various work with the database.

Expected results

You should be able to connect to a MySQL or MariaDB database using MySQL JDBC Driver. If you have problems with connecting, please, report a bug to http://bugzilla.redhat.com.