Problems connecting mariadb to base

I am having the exact same problem but using a remote mariadb server.
Connect to an existing database: MySQL/MariaDB
Connect using JDBC
Database & Server: Same as use in DBeaver
Port: 3306, Driver class: org.mariadb.jdbc.Driver, Tests good.
User name & password, same as used in DBeaver.
ERROR: "The connection could not be established.”

I’m using a Mac (M1) running OS 15.1.1, LO version 24.8.2.1 (AARCH 64), latest version of Java and MariaDB drivers.

I have been trying all sorts of things: making sure I have the latest versions, uninstalling & reinstalling Java, … I have been messing with this for many hours and don’t see what I am doing wrong. It appears that the connector is loading OK but not interfacing with the DB properly. Please note that the same settings in DBeaver and PHPAdmin work fine. Any suggestions?

Ask the database administrator of the remote mariadb server about connection details, listening ports, legitimate user accounts. Possibly he/she can give you a valid connection URL for JDBC drivers.


Status bars of 3 Base documents successfully connected to test database “dummy” served by a MariaDB server running on localhost, listening to port 3306.
The first one is a manually entered JDBC-URL (via connection type “JDBC”)
The second one comes from the wizard (via connection type Maria/MySQL, then JDBC).
The third one comes from the wizard (via connection type Maria/MySQL, then MariaDB C connector).
Currently, I have no ODBC driver installed, but it used to be working with ODBC as well.

Did that already and the connection details work fine on DBeaver, but not on LibreOffice.

I am embarrassed to say that I had a typo in the server name all this time. It is working fine now.

2 Likes

I spoke too soon.
LibreOffice is now connecting fine but drops the link in about a minute. There does not seem to be a solution other than closing the DB and re-opening it. I am finding a lot of reports of this happening, but I have not found a good solution. I have read tons of information on the MariaDB connectors and LibreOffice Base advice but still found nothing that works.

To review:
• Connect to an existing database: MySQL/MariaDB on a hosted server service.
• DBeaver works fine but occasionally drops the connection, in which case a reconnect popup box with a button fixes the connection.
• I’m using a Mac (M1) running OS 15.1.1, LO version 24.8.2.1 (AARCH 64)
• latest version of Java and MariaDB drivers (mariadb-java-client-3.5.1.jar) Because I have a Mac with the Apple silicon, it appears that the MariaDB JDBC java connector is preferred.
Connect using jdbc:mariadb://host_name:3306/database_name

  • Works fine for about 60 seconds. Is there a parameter I can add to the connection string to keep the connection alive?

You may try autoReconnect=true

1 Like

Thanks for the suggestion. Unfortunately, this feature was removed in the 3.0.0 version rewrite.

However, I will try installing a pre 3.0.0 version of the connector and see if this works. But because I have a Mac on the newer silicon platform, older versions of anything are problematic so I try to keep to the latest revisions.

This is really starting to look like a bug in the LibreOffice/MariaDB connector updates.

If the feature autoreconnect=True was removed by the Mariadb team, then it is an upstream problem, not something related to LO.

The fact that LO drops the connection over WAN has always been problematic. The previous workaround of using autoreconnect=True was just that, a workaround.

There are many things still not implemented in the sdbc driver code, it is also one of the unfortunate drawbacks of LO Base. Usually though, the jar connectors have tended to have better functionality - did you try with the mysql jdbc connector jar to see whether the autoreconnect string is still supported?

Thanks for the suggestion. I will try the mysql as well as older versions of the MariaDB version. For now, I have some other things to catchup on and will get back to this in a few days.

I really like the idea of using LibreOffice as a hosted SQL database client for multiple users. I have a few different applications that this inexpensive solution could work for and the possible uses are extensive. To get something useful working to tide me over, I will use a shared .odb file, carefully limiting it to one user at a time. I will still need to work out a hosted DB connector eventually.

If there are any developers watching this, I recommend checking out how DBeaver solved this. Their reconnect popup window works great.

Unfortunately, writing java bridging code to handle this probably isn’t high on the list of LO development priorities, given that the overall goal is to reduce reliance on Java code, some day, maybe never. For the rest, it is a matter of trying to prevent bitrot in the existing Base code, already a thankless task.

1 Like

As I know, none of Java bridges was developed in the project. Even more, LO is trying to avoid any use of Java. That was one of the reasons to choose Firebird for the embedded database.

1 Like

It is starting to look like I can’t reliably use LO as a client for the MariaDB hosted server we have been using. According to the MariaDB site, they are only maintaining the java connector for current and future updates.

I really appreciate the great feedback given here.

“They” is MariaDB. Have you tried the direct connector provided by LibreOffice/TDF?
.
I have not much experience with the java-connectors, as I use usually ODBC. I remember the use of odbc-drivers was possible on MacOS, but Apple has not provided/removed a possibillity to configure this. There were 3rd-party drivers available when I checked this (around 6 years ago).

Yes, I tried the ODBC connector and could not get it to work. It is possible I did not have the server address string correct, but I tried several things with it. Excel also uses the ODBC connector to link to databases and I couldn’t get that to work either.

Various versions of this with and without the prefix and suffix:
mariadb://server-name:3306/

I have not yet tried installing older connector versions.

ODBC support on macOS is a whole other topic. It can be done, but not via the version of LO obtainable from the Appstore.

When it does run, it has its own issues, due to the lack of ongoing ODBC support development in the LO codebase.

I have used Actual Technologies ODBC driver in the past. Again, it has worked on and off over the years, depending on macOS version, LO version, and their ODBC driver version.

1 Like

I really appreciate all the advice and comments given here. I will check out the Actual Technologies version, but it too, does not sound solid. I need a reliable solution that I can count on working for years of updates and such. I don’t want to worry about fixing connectors. LibreOffice has evolved into a wonderful application suite but is not yet ready as a solid, reliable database client, at least not for my applications.

The comments and advice here has helped me a lot. Thanks.

You can’t blame that entirely on LO. Apple has severely restricted the possibility for apps:

  • to include functionality that calls out to libraries outside of Apple’s app jail rules;
    and
  • for libraries such as independent database drivers to install themselves into locations other than those prescribed by Apple.

Sorry, I’m not blaming anyone and apologize if I gave any other impression. What I meant is that the combination of Apple’s OS, MariaDB, and using LO as a DB client, is not reliable enough yet for my needs. Maybe it is a shared standards issue, I don’t know. It is outside my capabilities to solve at this time. I need to find a plan B.

Replace LO with some other frontend and the result will be the same.

You may be right, but as I mentioned DBeaver works perfectly as a client using MariaDB’s Java connector, so there is hope.

All I am pointing out is that LO works perfectly for about 60 seconds (as far as I can tell) using the same connector and settings as DBeaver on the same platform. So apparently DBeaver figured out how to solve this and for whatever reason, LO has not yet done so, or I am still missing something.

DBeaver appears to have a way to autoreconnect using the latest Java connector revision (that does not have that option) to maintain the connection, and a popup to reconnect if the connection is eventually dropped. Whatever they did, it works well.