【问题标题】:how to specify trust store and trust store password in jTDS connection url?如何在 jTDS 连接 url 中指定信任库和信任库密码?
【发布时间】:2014-05-07 11:26:34
【问题描述】:

我正在编写一个 java 应用程序,它使用 jTDS 通过 ssl 连接连接到数据库。 我已将属性 ssl=require 添加到连接 URL 以启用 ssl 连接。

但是我找不到如何配置属性,我可以在其中指定要使用的信任存储以及它的密码是什么?此处列出了所有 jTDS 连接属性:http://jtds.sourceforge.net/faq.html

SQL 服务器 jdbc 驱动程序具有此类属性 trustStore 和 trustStorePassword,根据此链接:http://technet.microsoft.com/en-us/library/bb879949.aspx

知道如何使用具有这些属性的 jTDS 配置 ssl 连接吗?

【问题讨论】:

    标签: java sql-server-2008 ssl jdbc jtds


    【解决方案1】:

    您可以通过Java application动态指定trustStorekeyStore位置及其密码,如下:

    System.setProperty("javax.net.ssl.trustStore", trustStore file path goes here);
    System.setProperty("javax.net.ssl.trustStorePassword", password goes here);
    
    System.setProperty("javax.net.ssl.keyStore", keyStore file path goes here);
    System.setProperty("javax.net.ssl.keyStorePassword", password goes here);
    

    【讨论】:

      猜你喜欢
      • 2010-09-24
      • 2018-05-06
      • 2022-07-08
      • 2018-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-26
      • 1970-01-01
      相关资源
      最近更新 更多