Bug 989246

Summary: LibreOffice Base attempts to load a wrong class driver to connect to formerly MySQL databases (now MariaDB)
Product: [Fedora] Fedora Reporter: Rubén <rlledo>
Component: libreofficeAssignee: Stephan Bergmann <sbergman>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 19CC: caolanm, dtardon, erack, ltinkl, mstahl, sbergman, xjakub
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libreoffice-4.1.0.4-5.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-04 00:01:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Steps to reproduce the error
none
LibreOffice Base configuration none

Description Rubén 2013-07-28 17:44:38 UTC
Created attachment 779393 [details]
Steps to reproduce the error

Description of problem:
LibreOffice Base attempts to load driver class "com.mysql.jdbc.Driver" instead of "org.mariadb.jdbc.Driver".


Version-Release number of selected component (if applicable):
19

How reproducible:


Steps to Reproduce:
(See attached screenshots)

Actual results:
A database connection failure.

Expected results:
A database connection establishment.


Additional info:

Comment 1 Rubén 2013-07-28 17:47:05 UTC
Version is LibreOffice Base 4.1.0.1-8.fc19.

Comment 2 Caolan McNamara 2013-07-29 14:06:28 UTC
caolanm->sberg: can you have a look ?

Comment 3 Stephan Bergmann 2013-07-30 13:17:48 UTC
There is two issues here:

First, if you manually change "File - New - Database - Connect to an existing database: MySQL - Next >> - Connect using JDBC (Java Database Connectivity) - Next >> - MySQL JDBC driver class:" from "com.mysql.jdbc.Driver" to "org.mariadb.jdbc.Driver", then any further uses of that connection (like "Next >> - Test Connection") should use the changed class name, but did not.  This will be fixed in libreoffice-4.1.0.4-5.fc19.

Second, given <http://fedoraproject.org/wiki/Features/ReplaceMySQLwithMariaDB>, it might also make sense to change the default class name pre-filled at "File - New - Database - Connect to an existing database: MySQL - Next >> - Connect using JDBC (Java Database Connectivity) - Next >> - MySQL JDBC driver class:" from "com.mysql.jdbc.Driver" to "org.mariadb.jdbc.Driver".  However, I am not sure what the intended state is in F19, where I still find mysql-connector-java-5.1.24-1.fc19.noarch with /usr/share/java/mysql-connector-java-5.1.24.jar containing com/mysql/jdbc/Driver.class, but no package that would contain a corresponding mariadb-java-client jar containing org/mariadb/jdbc/Driver.class.  So I leave that as is for now (changing it would require patching the value of /org.openoffice.Office.DataAccess.Drivers/Installed/["sdbc:mysql:jdbc:*"]/Properties/["JavaDriverClass"]/Value from "com.mysql.jdbc.Driver" to "org.mariadb.jdbc.Driver" in connectivity/registry/mysql/org/openoffice/Office/DataAccess/Drivers.xcu, or even changing that upstream).

(Rubén, you presumably also needed to add the mysql-connector-java jar to LibreOffice's JVM classpath once via "Tools - Options... - LibreOffice - Advanced - Java options - Class Path..." and would need to change that to the mariadb-java-client jar now.)

Comment 4 Stephan Bergmann 2013-07-30 16:18:21 UTC
(In reply to Stephan Bergmann from comment #3)
> Second, given
> <http://fedoraproject.org/wiki/Features/ReplaceMySQLwithMariaDB>, it might
> also make sense to change the default class name pre-filled at "File - New -
> Database - Connect to an existing database: MySQL - Next >> - Connect using
> JDBC (Java Database Connectivity) - Next >> - MySQL JDBC driver class:" from
> "com.mysql.jdbc.Driver" to "org.mariadb.jdbc.Driver".  However, I am not
> sure what the intended state is in F19, where I still find
> mysql-connector-java-5.1.24-1.fc19.noarch with
> /usr/share/java/mysql-connector-java-5.1.24.jar containing
> com/mysql/jdbc/Driver.class, but no package that would contain a
> corresponding mariadb-java-client jar containing
> org/mariadb/jdbc/Driver.class.  So I leave that as is for now (changing it
> would require patching the value of
> /org.openoffice.Office.DataAccess.Drivers/Installed/["sdbc:mysql:jdbc:*"]/
> Properties/["JavaDriverClass"]/Value from "com.mysql.jdbc.Driver" to
> "org.mariadb.jdbc.Driver" in
> connectivity/registry/mysql/org/openoffice/Office/DataAccess/Drivers.xcu, or
> even changing that upstream).

Miloš, any background information on mysql-connector-java vs. mariadb-java-client in F19?

Comment 5 Fedora Update System 2013-07-30 19:04:58 UTC
libreoffice-4.1.0.4-5.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/libreoffice-4.1.0.4-5.fc19

Comment 6 Rubén 2013-07-30 19:36:22 UTC
Created attachment 780810 [details]
LibreOffice Base configuration

Comment 7 Rubén 2013-07-30 19:37:21 UTC
(In reply to Stephan Bergmann from comment #3)
> There is two issues here:
> 
> First, if you manually change "File - New - Database - Connect to an
> existing database: MySQL - Next >> - Connect using JDBC (Java Database
> Connectivity) - Next >> - MySQL JDBC driver class:" from
> "com.mysql.jdbc.Driver" to "org.mariadb.jdbc.Driver", then any further uses
> of that connection (like "Next >> - Test Connection") should use the changed
> class name, but did not.  This will be fixed in libreoffice-4.1.0.4-5.fc19.
> 
> Second, given
> <http://fedoraproject.org/wiki/Features/ReplaceMySQLwithMariaDB>, it might
> also make sense to change the default class name pre-filled at "File - New -
> Database - Connect to an existing database: MySQL - Next >> - Connect using
> JDBC (Java Database Connectivity) - Next >> - MySQL JDBC driver class:" from
> "com.mysql.jdbc.Driver" to "org.mariadb.jdbc.Driver".  However, I am not
> sure what the intended state is in F19, where I still find
> mysql-connector-java-5.1.24-1.fc19.noarch with
> /usr/share/java/mysql-connector-java-5.1.24.jar containing
> com/mysql/jdbc/Driver.class, but no package that would contain a
> corresponding mariadb-java-client jar containing
> org/mariadb/jdbc/Driver.class.  So I leave that as is for now (changing it
> would require patching the value of
> /org.openoffice.Office.DataAccess.Drivers/Installed/["sdbc:mysql:jdbc:*"]/
> Properties/["JavaDriverClass"]/Value from "com.mysql.jdbc.Driver" to
> "org.mariadb.jdbc.Driver" in
> connectivity/registry/mysql/org/openoffice/Office/DataAccess/Drivers.xcu, or
> even changing that upstream).
> 
> (Rubén, you presumably also needed to add the mysql-connector-java jar to
> LibreOffice's JVM classpath once via "Tools - Options... - LibreOffice -
> Advanced - Java options - Class Path..." and would need to change that to
> the mariadb-java-client jar now.)


The trick is NOT to install the package "mysql-connector-java.noarch", BUT manually create a symlink to "/usr/share/java/mariadb-java-client-1.1.0.jar" named "/usr/share/java/mysql-connector-java.jar" and set it in LibreOffice (tools > options > LibreOffice > Advanced > Class path), just as it can be seen in the attached screenshot.

This perfectly works in, for example, Eclipse (only in a development environment, of course). In order not to recompile all my projects with the new jar containing the driver, I create the symlink "<app_root_dir>/WEB-INF/lib/mysql-connector-java.jar" pointing to "/usr/share/java/mysql-connector-java.jar". However, it doesn't seem to work with LibreOffice Base.

Regards.

Comment 8 Stephan Bergmann 2013-07-31 07:40:13 UTC
(In reply to Rubén Lledó from comment #7)
> This perfectly works in, for example, Eclipse (only in a development
> environment, of course). In order not to recompile all my projects with the
> new jar containing the driver, I create the symlink
> "<app_root_dir>/WEB-INF/lib/mysql-connector-java.jar" pointing to
> "/usr/share/java/mysql-connector-java.jar". However, it doesn't seem to work
> with LibreOffice Base.

Now, I'm confused.

* On the one hand, the scenario you describe in your screenshot (attachment 780810 [details]) should work now with libreoffice-4.1.0.4-5.fc19.

* On the other hand, adding some /usr/lib64/libreoffice/WEB-INF/lib/mysql-connector-java.jar symlink (if that is what you imply with the above paragraph) should have no impact on LibreOffice.

Comment 9 Rubén 2013-07-31 23:49:28 UTC
(In reply to Stephan Bergmann from comment #8)
> (In reply to Rubén Lledó from comment #7)
> > This perfectly works in, for example, Eclipse (only in a development
> > environment, of course). In order not to recompile all my projects with the
> > new jar containing the driver, I create the symlink
> > "<app_root_dir>/WEB-INF/lib/mysql-connector-java.jar" pointing to
> > "/usr/share/java/mysql-connector-java.jar". However, it doesn't seem to work
> > with LibreOffice Base.
> 
> Now, I'm confused.
> 
> * On the one hand, the scenario you describe in your screenshot (attachment
> 780810 [details]) should work now with libreoffice-4.1.0.4-5.fc19.
> 
> * On the other hand, adding some
> /usr/lib64/libreoffice/WEB-INF/lib/mysql-connector-java.jar symlink (if that
> is what you imply with the above paragraph) should have no impact on
> LibreOffice.

I really didn't get through to you. I didn't want to mean that "<app_root_dir> = /usr/lib64/libreoffice". That's the point of your misunderstanding. In fact, they are two different things. I just tried to use Eclipse (an IDE for Java and Web Application development) as an example of another different application which works with my "trick". It doesn't matter what "<app_root_dir>" means; the issue is that both applications make use of a symlink and worked in Fedora 18, but one of them no longer works in Fedora 19 (I mean LibreOffice Base).

Respect to LibreOffice's version, I mentioned before that I noticed the bug in version 4.1.0.1-8.fc19. I made an upgrade today to version 4.1.0.4-1.fc19 but the error still remains (I always use the lastest packages in Fedora's repository). I'll have to wait for libreoffice-4.1.0.4-5.fc19 to be in Fedora's repository to check it out.

Anyway, I think that pushing libreoffice-4.1.0.4-5.fc19 to Fedora's repository in order to correct the default driver class name is the best solution.

Comment 10 Fedora Update System 2013-08-02 03:42:18 UTC
Package libreoffice-4.1.0.4-5.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing libreoffice-4.1.0.4-5.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-14010/libreoffice-4.1.0.4-5.fc19
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2013-08-04 00:01:15 UTC
libreoffice-4.1.0.4-5.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.