Bug 77584 - libreoffice-mysql-connector doesn't work over SSH tunnel from the internet
Summary: libreoffice-mysql-connector doesn't work over SSH tunnel from the internet
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: (target:4.2.6)(target:4.3.0)(target:4...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-17 16:57 UTC by edonkey2001-libreoffice
Modified: 2014-07-16 14:30 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description edonkey2001-libreoffice 2014-04-17 16:57:22 UTC
1. Set up a MySQL server
2. Install libreoffice-mysql-connector on a client in the same LAN (not on the server)
3. Tunnel a local port over SSH to your MySQL server
3. Open Base, choose to connect to a database of type MySQL
4. Decide to connect directly (not through JDBC or ODBC)
5. Enter localhost and the port you tunneled over SSH

Expected behavior: The connection works
Real behavior: An error message pops up citing problems with a file /var/run/mysqld/mysqld.sock

See also https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1276442

If you need more details, please ask for them.
I'm on Debian 7
Comment 1 edonkey2001-libreoffice 2014-04-18 00:28:32 UTC
I managed to connect from the LAN by installing (on Debian stable) libreoffice from backports (and hence libreoffice-mysql-connector from backports too). Still I can't connect from the internet with the very same settings. I can SSH into my server and the tunnel works too, so it has to be a LO problem.
Comment 2 edonkey2001-libreoffice 2014-04-18 13:26:26 UTC
I changed the subject to reflect the fact it does work on the same LAN by installing the version 1.0.2+LibO4.1.4-2~bpo70+1 (requires Libreoffice from backports) but not from the internet.

I admit my previous comment may have been a bit misleading. What I meant with "very same settings" was referred to the configuration in LO Base, of course not to the establishment of a remote tunnel vs a local one.
For the sake of clarity I repeat that I can SSH remotely from outside the LAN and the tunnel test correctly in this setting, just LO Base can't use it.

I've been asked to point out that exist a version of this extension for AOO
http://extensions.openoffice.org/en/project/mysql-connector-openofficeorg
or
http://extensions.openoffice.org/en/node/5644
that, according to comment #6 by jph on
https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1276442
should already be fixed. But these extensions can't be installed on Debian stable.

For completeness, here's the bug report I filed on Debian BTS:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=745101
Comment 3 Robert Großkopf 2014-04-21 19:33:42 UTC
Where did you get the direct connection to MySQL from?

Please don't use a connector written for OpenOffice or AOO for any LO-Version 4.1 or later. Values in timefields and timestamp-fields would be shown wrong in LO 4.1 and later. There is a difference between the code of AOO and LO since this version.

LO 4.1 would only get one more bugfix-release. So I don't know any working direct connection to MySQL.
Comment 4 edonkey2001-libreoffice 2014-04-21 20:18:55 UTC
I installed libreoffice-mysql-connector from Debian 7 repositories.
I did not test with any extension intended for AOO. I'm not understanding your last statement, can you clarify?
Comment 5 Robert Großkopf 2014-04-22 06:32:01 UTC
(In reply to comment #4)
> I installed libreoffice-mysql-connector from Debian 7 repositories.
> I did not test with any extension intended for AOO. I'm not understanding
> your last statement, can you clarify?

There isn't any libreoffice-mysql-connector, supported by LO, available for LO 4.1 and all other versions where bugfixes would be made in the future. The connector is an extension. When you have installed the connector from Debian 7 the only possibility to get a fix of the connector is to write a bugreport for Debian, not for LibreOffice.

Whats the version of LO you are using?
Comment 6 Rene Engelhard 2014-04-22 07:03:22 UTC
that is nonsense. Yes, you as LO mkight not ship it on some site but there IS
a mysql-connector in the tree. still.

http://cgit.freedesktop.org/libreoffice/core/tree/configure.ac#n799
(which is what we are talking about, it still creates mysql-connector as
the extension name)
http://cgit.freedesktop.org/libreoffice/core/tree/mysqlc

so it *is* your bug. (And yes, he filed this in Debian, too.)
Comment 7 Rene Engelhard 2014-04-22 07:53:21 UTC
if it's really completely unsupported it should be gone (it's in 4.2 tree and maste), currently I am contining shipping it:
https://packages.debian.org/search?keywords=libreoffice-mysql-connector

And note he already said in this comments which versions he used.
a)
"For completeness, here's the bug report I filed on Debian BTS:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=745101"

That one already says 3.5.4.
"installed libreoffice-mysql-connector from Debian 7 repositories."

Debian 7 is wheezy, see the above URL: 3.5.4.

b) 4.1.4 (see https://bugs.freedesktop.org/show_bug.cgi?id=77584#c2)
Comment 8 Robert Großkopf 2014-04-22 11:45:37 UTC
(In reply to comment #6)
> that is nonsense. Yes, you as LO mkight not ship it on some site but there IS
> a mysql-connector in the tree. still.

I am only a user of LO. I don't know anything about the source-code of LO and are not able to fix any bug.
> 
> http://cgit.freedesktop.org/libreoffice/core/tree/configure.ac#n799
> (which is what we are talking about, it still creates mysql-connector as
> the extension name)
> http://cgit.freedesktop.org/libreoffice/core/tree/mysqlc

Could be that there is anything in the source code. But I, as a "only user" of LO, couldn't get the mysql-connector for LO 4.1 or newer - I don't know where I should get the extension.

I don't search every link of a bug-report to see which version the reporter is using. I read the reports, don't find anything there and don't find the version chosen in this bug-report. So I asked for the version.

I couldn't solve the problem here. So this would be my last comment for this.
Comment 9 Julien Nabet 2014-05-30 15:14:01 UTC
Noel: seeing this commit, I thought you might be interested to be in cc of this tracker. Would it be possible you cherry-pick this for 4.3 and 4.2 branch?

(Meanwhile put it at NEW since it's been confirmed)
Comment 10 Julien Nabet 2014-05-30 15:14:41 UTC
oups, forgot to indicate the commit:
http://cgit.freedesktop.org/libreoffice/core/commit/?id=6b50e21473e7d2b24b5c609d8a1c31f27644d842
Comment 11 Rene Engelhard 2014-05-30 18:30:34 UTC
can confirm the fix makes it work in 4.2.x
Comment 12 Julien Nabet 2014-06-04 21:21:46 UTC
Following Rene's comment, I cherry-picked for review the Noel's fix:
4.3: https://gerrit.libreoffice.org/9642
4.2: https://gerrit.libreoffice.org/9643

(Noel: if there's any problem with these, just tell me and I abandon them. I thought this patch was really helpful and straightforward)
Comment 13 Julien Nabet 2014-06-05 11:22:21 UTC
The patch has been pushed in both branches.
So let's put this as FIXED.

If, after 48 hours , you can reproduce the problem with a 4.2 or 4.3 daily build, don't hesitate to reopen this tracker.
Comment 14 Y 2014-07-15 19:20:32 UTC
Hi Julien,
thank you so much for pushing the patch to both branches.  I have to report half success.

Testing with Xubuntu 14.04 and with LibreOffice from PPA:
* Version 1:4.2.5~rc2-0ubuntu2 from the PPA still can't connect
* Version 1:4.3.0~rc2-1ubuntu1~trusty0 from the pre-releases PPA connects fine.

SSH tunnel established with:
  ssh -L5000:server.example.com:3306 user@server.example.com

Manual connection test works well:
  mysql -h 127.0.0.1 --port=5000 -u dbuser - p

LibreOffice 4.2 branch of the PPA fails:

SQL Status: HY000
Error code: 2002

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

LibreOffice 4.3 branch connects well, but is it safe for production?

Is there a way to run both version concurrently? or to fix the 4.2 branch in the PPA?
Comment 15 Y 2014-07-15 19:30:03 UTC
I am afraid things are not working as expected with 4.3 either.

When I try to create a table, LibreOffice reports the following error:

SQL Status: 42000
Error code: 1142

CREATE command denied to user 'dbuser'@'localhost' for table 'Capacity'

The MySQL database was created server side as an empty database and the user was granted all privileges on it:

CREATE DATABASE test;
GRANT ALL PRIVILEGES ON test.* to 'dbuser'@'localhost' IDENTIFIED BY 'password';

A quick search for the error codes indicates that I am logged into mysql with a default null user with just about zero privileges.
Comment 16 Y 2014-07-15 19:54:22 UTC
More details:

when I create a table server side with
CREATE TABLE test (a VARCHAR(255), b INT(9));

it is not immediately visible / updated client side in LibreOffice.

when I close and reopen the database, the newly created table shows.

LibreOffice can edit the table in design field, e.g. add a field c VARCHAR(100), but not edit or add data.

server-side everything work as expected with the same user credentials.
Comment 17 Rene Engelhard 2014-07-15 21:09:47 UTC
Y: PPA is not in scope of this - ask your Ubuntu packager.

The patch is only in 4.2.6 officially, Debians packages have the patch backported. If your Ubuntu package doesn't have the patch - obviously it cannot work.

Your other problems might indicate an other bug - should be handled in an other bug, too.