To securely connect MySQL Data Access Components (MyDAC) to a MySQL server via an SSH tunnel, use the TCRSSHIOHandler component. This component acts as an adapter between the database client and the SSH client, enabling secure data transmission through unprotected communication channels such as the internet.
The following diagram illustrates the communication flow between the database client and server using TCRSSHIOHandler.
All data exchange between TMyConnection and TScSSHClient (which acts as the SSH client) is secure. Communication occurs entirely within the application through the methods of TCRSSHIOHandler.
However, the connection between the SSH server and the MySQL server is not secure, so ensure that it uses secure communication channels.
1. | Place the TScSSHClient component on your form and configure it with your SSH server connection details. For information, see SSH client setup. |
2. | Place the TCRSSHIOHandler component on your form. |
3. | In the Client property of TCRSSHIOHandler, select the TSCSSHClient object. |
4. | Place the TMyConnection component on your form and configure it with your MySQL server connection details. |
5. | In the IOHandler property of TMyConnection, select the TCRSSHIOHandler object. |
6. | Connect to your MySQL server by setting the Connected property of TMyConnection to True. |