安装和升级 > 安装 ThingWorx > 安全配置 > TLS 配置 > 为 MSSQL 配置 SSL/TLS
为 MSSQL 配置 SSL/TLS
ThingWorx Platform 使用 JDBC 驱动程序连接其持久化方案提供工具。ThingWorx Platform 支持 SSL 连接的前提是 JDBC 驱动程序和 Microsoft SQL Server 数据库版本支持 SSL 连接。
对于 TLS 1.3,需要使用 MSSQL JDBC 驱动程序版本 10.1 及更高版本,Microsoft SQL Server 2022 是支持此功能的最早版本。较旧的 MSSQL JDBC 驱动程序和 Microsoft SQL Server 版本支持 TLS 1.2。
要确定 xxx-JDBC-xxx.Jar,请在路径 [tomcat_home]\webapps\Thingworx\WEB-INF\lib 下查看 ThingWorx Platform 版本所使用的 OOTB JDBC 驱动程序版本。
ThingWorx 9.6 及更高版本使用 mssql-JDBC-12.6.jre11.jar 驱动程序版本连接到 Microsoft SQL Server 数据库。
配置 Microsoft SQL Server
有关配置 SQL Server 以进行加密连接的详细信息,请参阅配置 SQL Server 数据库引擎以进行加密连接,包括证书配置。
配置 ThingWorx Foundation - 平台的持久化方案提供工具
1. 将 SQL Server 证书导入 ThingWorx/Java truststore。要将证书添加到全局 Java 库,请参阅为加密配置客户端
2. 保存现有 ThingworxPlatform/platform-settings.json 文件的副本。
3. 修改 ConnectionInformation 块下的 jdbcUrl 设置以包括 SSL 设置。
a. 要配置 TLS 1.2 连接,将 encrypt=true;trustServerCertificate=false 添加至 jdbcUrl。例如,jdbc:sqlserver://localhost:1433;databaseName=thingworx;applicationName=Thingworx;encrypt=true;trustServerCertificate=false
* 
将值设置为 trustServerCertificate=true,系统将允许连接信任证书而无需检查。如果使用此配置,则无需执行步骤 1 和步骤 2。
b. 要配置 TLS 1.3 连接,将 encrypt=strict 添加至 jdbcUrl 连接字符串。例如,jdbc:sqlserver://localhost:1433;databaseName=thingworx;applicationName=Thingworx;encrypt=strict
4. 重新启动 ThingWorx Platform 服务并进行验证。
配置 ThingWorx Foundation - 数据库事物
如果要使用 ThingWorx 中的数据库事物模板连接到 Microsoft SQL Server 数据库:
1. 将 SQL Server 证书导入 ThingWorx/Java truststore。要将证书添加到全局 Java 库,请参阅为加密配置客户端
2. 打开数据库事物,然后单击“配置”
3. 修改 JDBC 连接字符串值以包括 SSL 相关设置。例如:
对于 TLS 1.2 - jdbc:sqlserver://localhost:1433;databaseName=thingworx;applicationName=Thingworx;encrypt=true;trustServerCertificate=true
对于 TLS 1.3 - jdbc:sqlserver://localhost:1433;databaseName=thingworx;applicationName=Thingworx;encrypt=strict
4. 保存实体并验证。
这对您有帮助吗?