Mysql database connection (programmatically) with ca.pem, cert.pem, and key.pem

4 views (last 30 days)
Hello,
I am trying to connect to a remote database (programmatically) via a java connection (mysql-connector-j-XXX) that requires an ssl certificate.
The connection is a programmatic connection
I cannot find the correct parameters for the certifcate components
ie. ca.pem
ie. client-cert.pem
ie. client-key.pem
I would sincerely appreciate an example (see: unknown_xx_param below) as I cannot locate documentation for these within the matlab manual.
or within the community forum. The closest post I can find is [ here ].
The method I am implementing takes the following form
vendor = 'MySql';
user = 'my_username';
password = 'my_password';
host = 'my_host';
port = 3306;
ca_file = '/path/ca.pem';
client_cert_file = '/path/client-cert.pem';
client_key_file = '/path/client-key.pem';
sql = '?verifyServerCertificate=true&useSSL=true&requireSSL=true&allowPublicKeyRetrieval=true&useUnicode=yes&characterEncoding=utf-8&character-set-server=utf8mb4&collation-server=utf8mb4_0900_ai_ci&use_pure=True';
conn = database(...
sql, ...
user, ...
password, ...
'Vendor', vendor, ...
'Server', host, ...
'Port', port, ...
'unknown_ca_param', ca_file, ...
'unknown_cert_param', client_cert_file, ...
'unknonw_key_param', client_key_file ...
);
The error type generated by numerous incorrect parameter attemts is:
Unmatched parameter name XXX must be a string scalar or character vector that can represent a field name.
Many thanks in advance.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!