[CONJ-858] Properties parameter different than string not taken in account Created: 2021-02-15  Updated: 2021-05-12  Resolved: 2021-02-22

Status: Closed
Project: MariaDB Connector/J
Component/s: configuration
Affects Version/s: None
Fix Version/s: 2.7.3, 3.0.0

Type: Task Priority: Minor
Reporter: Henry Hwang (Inactive) Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by CONJ-882 TLS connection parameters are ignored... Closed

 Description   

The published doc https://mariadb.com/products/skysql/docs/clients/mariadb-connector-j-for-skysql-services/ has the code snippet where it shows:

connProperties.put("user", "db_user");
connProperties.put("password", "db_password");
connProperties.put("useSSL", true);
connProperties.put("serverSslCert", "/path/to/skysql_chain.pem");

The value for the useSSL parameter isn't in quotes. This generates a bad handshake error:

java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=henry-xpand-ssl.mdb0001358.db.skysql.net)(port=5001)(type=master) : (conn=110) Bad SSL handshake
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:192)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1372)
at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:635)
at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:150)
at org.mariadb.jdbc.Driver.connect(Driver.java:89)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:189)
at doc.main(doc.java:21)
Caused by: java.sql.SQLNonTransientConnectionException: (conn=110) Bad SSL handshake
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:187)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authenticationHandler(AbstractConnectProtocol.java:769)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:546)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1367)
... 6 more

When the value is in double-quotes, the JDBC connection works.



 Comments   
Comment by Diego Dupin [ 2021-02-22 ]

Properties connProperties = new Properties();
connProperties.setProperty("useSSL", "true");

is ok,
but using the same as object will only be taken in account when value has a string value

Properties connProperties = new Properties();
connProperties.put("useSSL", true);

useSSL will not be enable, without any error.

Comment by Diego Dupin [ 2021-02-22 ]

asked for documentation change in https://mariadb.com/products/skysql/docs/clients/mariadb-connector-j-for-skysql-services/ as well for compatibility before 2.7.3 version

Generated at Thu Feb 08 03:18:49 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.