"com.mysql.jdbc.Driver could not be loaded" on 7.0.6.2

This morning I was informed by a user of my MySQL/Base setup that they were unable to log in. I had made tweaks to the scripts in my .odb that required upgrading to 7.0.6.2, so I brought their machine up to that version. Now, I keep getting this error message could this have something to their mysql-connector J?

Should I be using the ODBC connector instead?

Is there a JDBC connector connected in the class path? (Tools → Options → LibreOffice → Advanced → Class Path …)

Could also be you updated the connector. With version 5.2 it changed from com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver.

Yes, there is. I was under the impression that this was no longer needed for the latest version of LO, but it’s still there. It’s mysql-connector-java-5.1.44-bin.jar.

Well, I was tinkering with it, and in the .odb file, I went into Edit>Database>Connection Type and tried switching it to ODBC, and started getting errors that " could not be loaded. Now, I don’t know what database type to put it back on, and I keep getting “unknown database” errors. Do I need to go through some sort of re-regristration process for my database?

I figured out from an older version of my .odb file that I needed to select “MySQL(JDBC)” and then went back into Advanced Settings and manually entered the IP address of the server where the MySQL resides. Now, I keep getting “The driver class ‘’ could not be loaded.”

Now, if I go into the “Additional Settings” tab in “Database Properties” and hit “Test Class”, I get “The JDBC driver was loaded successfully.” That’s with the class “com.mysql.jdbc.Driver”. But if I switch the class to “com.mysql.cj.jdbc.Driver”, I get “The JDBC driver could not be loaded.”.

Help!?!

“Test Class” says the driver is loading correctly. “Test Connection” says it is not. How is that possible?

Well, this is stupid. I was looking through the “Expert Configuration” options, and saw some things about timeout. So, I logged out of Windows and logged back in. After that, I could log in normally.

When using mysql-connector-java-5.1.44-bin.jar com.mysql.jdbc.Driver should be right.

Test class only means: I get connection to the JDBC-Driver. If you connect to a database, which isn’t part of the internal network, you could better use JDBC-Driver without the special wizard for MySQL. The connection-string should be something like

jdbc:mysql://«HostOfDatabase»:3306/«Datenbasename»?autoReconnect=true

So the connection won’t be interrupted. You could also try to set through Tools → SQL

SET SESSION wait_timeout=600;

If this is allowed in your database the connection will be there for 10 minutes without any query to the database.

Sweet! How do I get to the connection-string for my .odb project?

The “normal” way is:
Database Wizard → Select Database → Connect to an existing Database → JDBC

If you have already create a *.odb:
Edit → Database → Connection Type… → JDBC

If you try it with MySQL(JDBC) there is no possibility to input something like ?autoReconnect=true.

I just found why the other machines still weren’t connecting, even with my MySQL credentials. Under Advanced Settings for LO, the pointer to the JDBC connector had been lost. :angry: So, once I went in and re-added the .jar file, things started working again. I’m still befuddled as to why they stopped working in the first place, before I upgraded LO on the other machines. I wonder whether it could be that I had upgraded my machine and used it to make changes to the .odb file.

Has anyone else observed where the pointer to the JDBC connector .jar file is dropped out of the blue?

I’ve determined that the pointer to the .jar file wasn’t simply lost. It disappeared because I upgraded LO. So, the failure to connect to the database must have been because I had saved changes to the .odb file with LO 7.0.6.2, and the other machines were still runnning LO5. One of the other machines that I never upgraded was still pointing to the .jar file.