PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Thomas Bock on July 06, 2021, 09:17:42 AM

Title: SSL connection to MySQL
Post by: Thomas Bock on July 06, 2021, 09:17:42 AM
Is it possible to build a SSL connection to a MySQL-Server?
How to do it with the OPEN directive?
Title: Re: SSL connection to MySQL
Post by: Devon Austen on July 06, 2021, 09:43:40 AM
To connect to a MySQL server from PxPlus you have two options.

One is to use the native MySQL interface: https://manual.pvxplus.com/?command_tags/mysql.htm

The other is to use a MySQL ODBC driver and the ODB interface: https://manual.pvxplus.com/?command_tags/odb.htm

For the native interface you will need to download and install the mysql c client and make sure the dll is in the system path so PxPlus can see it.

For the ODBC driver you will need to download and install the odbc driver and setup a DSN.

I believe both interfaces support secure SSL/TLS connections as the default if the server is setup for it.
Title: Re: SSL connection to MySQL
Post by: Mike King on July 06, 2021, 09:47:56 AM
You might want to review the following web site on how to configure MySql itself to use SSL.

https://dev.mysql.com/doc/refman/8.0/en/using-encrypted-connections.html
Title: Re: SSL connection to MySQL
Post by: Thomas Bock on July 07, 2021, 04:03:23 AM
Let me rephrase the question.
Using [MYSQL], how can I pass the certificates to the OPEN command?
Title: Re: SSL connection to MySQL
Post by: Devon Austen on July 07, 2021, 08:31:05 AM
The [MYSQL] interface does not support specifying a certificate.

It looks like the MySQL ODBC driver does have options for specifying a certificate. So I would suggest using the ODBC driver and creating a DSN with your SSL certificate set and the [ODB] interface to connect using that DSN.

Often when making a SSL/TLS connection only the server needs to specify a certificate and the client just validates it. I believe for MySQL it is the same and you can connect to a SSL/TLS secured MySQL using [MySQL] without specifying a certificate (with default MySQL server settings). So it is possible you don't need to worry about specifying the certificate. Of course your MySQL server may be setup to require it and if that is the case then you will want to use the ODBC driver so you can specify those options.