Search code examples
mysqldelphissldbexpressdbx

Connecting to MySQL via SSL, using DBExpress


I want to connect to a MySQL server via SSL. More specifically, I want to do that with DbExpress.

I've used SSL to MySQL via ZeosLib in the past. That worked great, but Zeos doesn't let me run stored procedures that return more than one resultset, which is a show-stopper in this project.

With Zeos, I used to set up an SSL connection like this:

  Connection := TZConnection.Create(nil);
  Connection.Properties.Values['MYSQL_SSL']     := 'TRUE';
  Connection.Properties.Values['MYSQL_SSL_CA']   := 'c:/pathtocert/cert.pem';
  Connection.Properties.Values['MYSQL_SSL_CERT'] := 'c:/pathtocert/foo.pem';
  Connection.Properties.Values['MYSQL_SSL_KEY']  := 'c:/pathtocert/bar.pem';

I see that you can do something similar with DBX:

Connection.Params.Values['drivername']  := 'MySQL';
Connection.Params.Values['compressed']  := 'True';
Connection.Params.Values['HostName']    := 'host';
Connection.Params.Values['Database']    := 'dbname';
Connection.Params.Values['user_name']   := 'me';
Connection.Params.Values['Password']    := '...';
Connection.Params.Values['encrypted']   := 'True'; // looks promising!

I see that you can set up a parameter called 'encrypted', but I don't see how I can configure the locations of the certificates. LibMySQL.dll needs those in order to set up its encrypted connection.

So my questions are:

  1. Does DBX allow me to set up an encrypted connetion?
  2. If so, can anyone tell me how to do that? :)

Solution

    1. Embarcadero MySQL dbExpress driver does not support SSL connection. Although that is really very simple to implement. You can log this request to QC.
    2. You can consider to use 3d party products, like AnyDAC.