MySQL connection using SSL

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 1
Joined: Mon 23 Dec 2019 08:15

MySQL connection using SSL

Post by chuahyen » Mon 23 Dec 2019 08:22

I use TUniConnection and set the Protocol to 'mpSSL'.
In windows, I added the libeay32.dll and ssleay32.dll to the application directory and it is able to connect to the MySQL.
However, in iOSDevice64, I tried to add the libcrypto.a and libssl.a files to the Startup/Documents folder in the deployment. Added this line of code to the project source
IdOpenSSLSetLibPath(TPath.GetDocumentsPath + PathDelim);

When I run the application to connect to the MySQL database, it states the Wrong or Unknown Protocol. Can't create SSL Connection.

I downloaded the SecureBridge to test out on IOS device but the demo does not have any example for it.
If SecureBridge can work, I will buy the SecureBridge
please advise on how to use it


Devart Team
Posts: 2875
Joined: Wed 30 Jul 2014 07:16

Re: MySQL connection using SSL

Post by ViktorV » Tue 24 Dec 2019 08:14

1. MyDAC allows you to establish SSL connections with MySQL in two ways: a. using OpenSSL and b. using SecureBridge components.
a. MyDAC uses the following OpenSSL libraries. You can deploy the library data with your application so that you do not depend on the availability of these libraries on your computer. But using OpenSSL libraries to create an SSL connection with MySQL server can lead to various problems. For example, OpenSSL version can be not supported by MySQL server, the bitness of the supplied OpenSSL libraries can differ from the bitness of your application, etc.
To solve the issue, you can use the SecureBridge components. SecureBridge allows you to establish secure connections within a single application without any external files. You can learn how to use SecureBridge with MyDAC in the "Secure connections" topic of MyDAC help.
The ability to create an SSL connection with MySQL server primarily depends on the server settings, which must be configured accordingly: SSL support is enabled and a user is created with the requirement to connect via SSL. Therefore, to solve your problem, you should create a user with the requirement to connect via SSL. The requirement for the use of certificates when setting up an SSL connection depends on the user's settings. For more information on this issue, please refer to the MySQL server documentation. To obtain the necessary data for setting up SSL, please contact the technical support of MySQL server.
To solve your task, please place on the form the TMySSLIOHandler component and assign it to the TMyConnection.IOHandler property.
The TMySSLIOHandler component is located in the mydacsbridgeXXX package. This package is included in the MyDAC demos. See the package installation instructions in the file "%MyDACDemos%\TechnologySpecific\SecureBridge\Readme.html", where %UniDACDemos% is the MyDAC Demo projects installation path on your computer.
If you have any questions after reading our answer - please contact us and we will try to give you a detailed answer in the shortest possible time.

Post Reply