[CONJ-763] Custom SocketFactory is unable to parse connection properties Created: 2020-02-26  Updated: 2020-03-18  Resolved: 2020-03-06

Status: Closed
Project: MariaDB Connector/J
Component/s: configuration
Affects Version/s: None
Fix Version/s: 2.6.0

Type: New Feature Priority: Major
Reporter: Vinicius C Caldeira Carvalho Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None

Attachments: Text File [CONJ-763]_provide_custom_SocketFactory_configuration_option.patch    

 Description   

The current implementation of the Utils class (https://github.com/mariadb-corporation/mariadb-connector-j/blob/master/src/main/java/org/mariadb/jdbc/internal/util/Utils.java#L124) makes it impossible for custom implementations of the SocketFactory to infer any information from the environment.

An example is what the Google Cloud SQL connector (https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory) needs to do in order to rotate certificates of the connection. It can use connection string arguments such as `cloudSqlInstance` to fetch the correct values.

The mysql driver and postgres driver all pass the properties down to the SocketFactory implementation, but not this driver. It would be nice to provide a way (maybe by trying a constructor with a Properties argument if that is present)

This is blocking me from adding mariadb as a connector for the google cloud sql project.



 Comments   
Comment by Diego Dupin [ 2020-03-04 ]

There can be a solution to provide custom SocketFactory configuration option.
like would this patch: [CONJ-763]_provide_custom_SocketFactory_configuration_option.patch
Could you confirm this would solve this use case ?

Comment by Diego Dupin [ 2020-03-06 ]

The patch provided enhance current situation, so is added to 2.6.0 version.
Feel free to create a new issue is that doesn't solve you use case.

Comment by Vinicius C Caldeira Carvalho [ 2020-03-06 ]

Thank you Diego, that does solve the problem, using ConfigurableSocketFactory would make it work. Cheers

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