Google Apps脚本中连接连接的JDBC证书要求

发布于 2025-01-31 21:32:22 字数 737 浏览 2 评论 0 原文

我正在尝试连接到本地SQL Server(Microsoft SQL Server Express),但是我一直遇到与证书验证有关的错误。

当我通过 encrypt = false trustServerCertificate = true 时,通过本地运行的Java(带有JDBC)的连接工作起作用,否则我会收到一个错误消息:

“错误:” PKIX路径构建失败:Sun.Security.Provider.CertPath.SuncertPathBuildErexception:无法找到所请求的目标的有效认证路径”。

“错误:” PKIX路径构建失败: //develvemens.google.com/apps-script/reference/jdbc/jdbc#getConnectionUrl,info“ rel =“ nofollow noreferrer”>(如在此处记录),但我不确定他们是什么在 _Serversslcertificate _ClientsSlcertificate 或 _CLIENTSLKEY five中,实际上在 _serversslcertificate _serverssslcertificate 中寻找

。我尝试在服务器上应用带有PowerShell和Windows IIS生成的自签名证书,但是在我执行此操作之后,它根本不会重新启动

I'm trying to connect to an on-premises sql server (Microsoft Sql Server Express), but I keep getting an error that has to do with the validation of the certificate.

Connections through locally-run java (with JDBC) work when I pass encrypt=false or trustServerCertificate=true, otherwise I get an error message :

"Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target".

I know that Google Apps Scripts allows for using self-signed certificates (as documented here), but I'm not sure what they're actually looking for in the _serverSslCertificate, _clientSslCertificate, or _clientSslKey fields.

Unfortunately, I'm not able to share more details about the network I'm working in. I've tried applying self-signed certificates generated with PowerShell and Windows IIS to the server, but it simply doesn't restart after I do this.

Any help is appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

九厘米的零° 2025-02-07 21:32:23

这些参数需要SSL证书以及服务器和客户端的密钥。如有记录在这里,您可以在这些参数上看到他们所需的预期值。请参阅下面的摘要:

var conn = Jdbc.getConnection('jdbc:mysql://<ip address>/<db name>?useSSL=true', { 
  user: '<user>', 
  password: '<pass>', 
  _serverSslCertificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----', 
  _clientSslCertificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----', 
  _clientSslKey: '-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----' 
});

您可以尝试以上片段,但这最初是针对MySQL的,据报道尚未适用于Microsoft SQL Server。后者有自己的问题发布在这里,但仍然没有任何更新。

可能帮助您的指南在下面链接。

参考:

These parameters require SSL certificates and key of the server and client. As documented here, you can see the expected values they need on those parameters. See snippet below:

var conn = Jdbc.getConnection('jdbc:mysql://<ip address>/<db name>?useSSL=true', { 
  user: '<user>', 
  password: '<pass>', 
  _serverSslCertificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----', 
  _clientSslCertificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----', 
  _clientSslKey: '-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----' 
});

You can try the above snippet but this is for MySQL originally and is reported to have not worked for Microsoft SQL Server. The latter has its own issue posted here but still doesn't have any updates.

Guides that might help you are linked below.

References:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文