使用 DBExpress 通过 SSL 连接到 MySQL
我想通过 SSL 连接到 MySQL 服务器。更具体地说,我想使用 DbExpress 来做到这一点。
我过去曾通过 ZeosLib 使用 SSL 连接 MySQL。这很有效,但 Zeos 不允许我运行返回多个结果集的存储过程,这是该项目中的一大亮点。
使用 Zeos,我曾经像这样设置 SSL 连接:
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';
我看到您可以使用 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!
我看到您可以设置一个名为“加密”的参数,但我不知道如何配置证书的位置。 LibMySQL.dll 需要这些才能建立其加密连接。
所以我的问题是:
- DBX 是否允许我建立加密连接?
- 如果是这样,谁能告诉我该怎么做? :)
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:
- Does DBX allow me to set up an encrypted connetion?
- If so, can anyone tell me how to do that? :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)