setTrustStorePassword 方法 (SQLServerDataSource)

下载 JDBC 驱动程序

设置用于检查 trustStore 数据完整性的密码。

语法

  
public void setTrustStorePassword(java.lang.String trustStorePassword)  

参数

trustStorePassword

包含用于检查 trustStore 数据完整性的密码的 String

注解

可随 trustStore 属性同时指定 trustStorePassword 属性,并使用其值来检查 trustStore 文件的完整性。

如果设置了 trustStore 属性,但未设置 trustStorePassword 属性,则不检查 trustStore 的完整性。

如果未指定 trustStore 和 trustStorePassword 属性,驱动程序将使用 Java 虚拟机 (JVM) 系统属性“javax.net.ssl.trustStore”和“javax.net.ssl.trustStorePassword”。 如果未指定“javax.net.ssl.trustStorePassword”系统属性,则不检查 trustStore 的完整性。

如果未指定 trustStore 属性,但设置了 trustStorePassword 属性,JDBC 驱动程序将使用由“javax.net.ssl.trustStore”指定作为信任存储区的文件,并使用指定的 trustStorePassword 检查信任存储区的完整性。 当客户端应用程序不希望在 JVM 系统属性中存储密码时,这一点可能是必需的。

有关详细信息,请参阅设置连接属性

从 JDBC Driver 3.0 开始,如果您在绑定数据源属性前设置 SQLServerDataSource.setTrustStorePassword,在获取连接前必须调用 SQLServerDataSource.setTrustStorePassword。 有关详细信息,请参阅 SQLServerDataSource.getReference

另请参阅

SQLServerDataSource 成员
SQLServerDataSource 类