Bug 119786 - Database Properties changes Name of the MySQL database string when a "/" is present
Summary: Database Properties changes Name of the MySQL database string when a "/" is p...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.0.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 120123 (view as bug list)
Depends on: 119850
Blocks: MariaDB
  Show dependency treegraph
 
Reported: 2018-09-10 14:27 UTC by Lars Schotte
Modified: 2019-07-30 14:29 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
libreoffice changing databasename string (1.60 MB, image/gif)
2018-09-10 14:37 UTC, Lars Schotte
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Schotte 2018-09-10 14:27:06 UTC
Description:
In order to connect to a database over MySQL JDBC driver which complains about the timezone, I need to set serverTimezone variable over mydbname?serverTimezone="Europe/Vienna".




Steps to Reproduce:
1. Open LibreOffice Base
2. Configure a MySQL server over JDBC driver
3. Pass in ?serverTimezone="Europe/Vienna" as a database name parameter

Actual Results:
Libreoffice Base connects to the DBMS successfully, however, after pressing OK in the Database Properties window, the the Name of the MySQL database string gets changed to Vienna. Looks like someone is using a split() function which filters out all "/" characters and returns the part after "/".

Expected Results:
Should not change the database name string.


Reproducible: Always


User Profile Reset: No



Additional Info:
I would suggest having something like escaping functionality, so that I can say "Europe/Vienna" without getting the "/" inside of "" filtered out.

Anyway, the connection works, so if this is a security feature, then it is a bad one, because it works one time, which is enough for a potential attack. The problem occurs the next time you open the saved libreoffice base file, when it tries to connect to the database name containing substring after "/".
Comment 1 Lars Schotte 2018-09-10 14:37:55 UTC
Created attachment 144773 [details]
libreoffice changing databasename string

Here how it looks like
Comment 2 Alex Thurgood 2018-09-14 11:21:06 UTC
@Lars: did this work correctly in previous versions ? If so, which ones ?
Comment 3 Alex Thurgood 2018-09-14 15:24:43 UTC
Confirming with LO 6062 MacOS 10.13.6
Comment 4 Julien Nabet 2018-09-14 21:59:27 UTC
Impossible to debug without fixing tdf#119850 first.
Comment 5 Alex Thurgood 2018-09-19 08:24:40 UTC
I would add that this bug also makes it impossible to use the latest mysql-connector-jar (8.0.12) as each time an attempt to load any tables containing timestamp fields is made an error message is produced:

"The server time zone value CEST is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimeZone configuration property) to use a more specific time zone value if you want to utilize time zone support."
Comment 6 Alex Thurgood 2018-09-19 09:00:07 UTC
Note that adding the string :

?serverTimezone=UTC

as can be found in other similar jdbc issues on the internet such as stackoverflow allows a workaround, however then no account is taken of local time at the point of entry by the user.
Comment 7 Alex Thurgood 2018-09-26 09:15:37 UTC
*** Bug 120123 has been marked as a duplicate of this bug. ***
Comment 8 Julien Nabet 2018-09-30 11:52:44 UTC
I'm not sure to understand, do you use Mysql then Jdbc or JDBC directly?

If Mysql then JDBC, I got an error message when adding "?serverTimezone="Europe/Vienna" to the database name.

For JDBC directly, i installed MariaDbServer + phpmyadmin, it worked.
I installed libmariadb-java and added this archive in Classpath.
Then I tried to test the driver with org.mariadb.jdbc.Driver, LO said it couldn't load the driver.
Comment 9 Julien Nabet 2018-09-30 12:25:01 UTC
(In reply to Julien Nabet from comment #8)
>...
> For JDBC directly, i installed MariaDbServer + phpmyadmin, it worked.
> I installed libmariadb-java and added this archive in Classpath.
> Then I tried to test the driver with org.mariadb.jdbc.Driver, LO said it
> couldn't load the driver.

Forget my last comment, the test of class loading is ok. It seems I clicked "Cancel" when adding the jar since the archive wasn't here.
Comment 10 Julien Nabet 2018-09-30 12:36:54 UTC
I used this string for connection:
mariadb://localhost:3306/btuc?serverTimezone="Europe/Vienna"
and I could open the tables of "btuc" database.

In edit/database, I got:
- Properties...
- Connection type...
- Advanced Settings...
In Properties, I can change DataSource URL, User auth, JDBC Properties, Test Class, Test connection
what should I do then?
Where is "Name of the MYSQL Database"?
Comment 11 Alex Thurgood 2018-10-01 12:32:01 UTC
(In reply to Julien Nabet from comment #10)

Hi Julien,

> Where is "Name of the MYSQL Database"?

The name of the database as it is displayed at the bottom of the main ODB window when you open the ODB file in LO.

The setup where I could reproduce was first choose JDBC in connection, wizard, then enter the connection string.

It seems that this might be limited to mysql connector JAR / mysql server configurations.
Comment 12 Julien Nabet 2019-03-17 10:25:05 UTC
On pc Debian x86-64 with master sources updated today + MariaDB server 10.3.13 + MariaDB connector JDBC 2.4.0, I don't reproduce this.

Here what I did:
- put "mysql://localhost/test?serverTimezone=Europe/Vienna" in database/properties/jdbc string.
- clicked "OK"
- At bottom center of my LO window, I can see:
mysql://localhost/test?serverTimezone=Europe/Vienna
Comment 13 Alex Thurgood 2019-07-30 14:29:34 UTC
Confirming that this works for me too with

Version: 6.4.0.0.alpha0+
Build ID: 736f65e53b966774f2d72e6f2479fd335986f5a6
CPU threads: 4; OS: Mac OS X 10.14.5; UI render: default; VCL: osx; 
Locale: fr-FR (fr_FR.UTF-8); UI-Language: en-US
Calc: threaded

mysql JDBC Connector 5.1.47

The timezone values are saved and visible in database connection parameters.