Must connect to a MariaDB database through a SSH tunnel.
Use putty to open the tunnel with port forwarding and get error message
RSA public key is not available client side (option serverRsaPublicKeyFile not set).
The database server provider does not support SSl/TLS encrypted messaging.
Apparently my jdbc-connector encrypts by default and I should switch that off.
But how?
Added encrypt=false in my Java code:
url = "jdbc:mysql://" + databaseURI.trim() + "/" + databaseSchema+ "/encrypt=false";
connection = DriverManager.getConnection(url, databaseUserName,
databasePassword);
as advised by my database server provider but that had no result.
MySQL's default authentication method is caching_sha2_password which requires a RSA public key. The RSA public key is either stored on client machine or can be retrieved from the server during connection handshake.
Since the second option is less secure, MySQL's JDBC driver disables this option by default. To enable retrieval of RSA public key you have to append
allowPublicKeyRetrieval=Trueto your connection url.I wonder why this question is tagged as mariadb, since MySQL JDBC connector is used on client side and obviously MySQL on server side (MariaDB doesn't offer authentication method which requires a RSA public key).