简体   繁体   English

如何在jTDS连接URL中指定信任库和信任库密码?

[英]how to specify trust store and trust store password in jTDS connection url?

I am writing one java application which connects to database with ssl connection using jTDS. 我正在编写一个Java应用程序,它使用jTDS通过ssl连接连接到数据库。 I have added the property ssl=require to the connection URL to enable ssl connection. 我已将属性ssl = require添加到连接URL以启用ssl连接。

But I couldn't find how to configure the properties where I can specify which trust store to use and what is the password for it? 但是我找不到如何配置属性的地方,可以在其中指定要使用的信任库及其密码是什么? All jTDS connection properties are listed here: http://jtds.sourceforge.net/faq.html 此处列出了所有jTDS连接属性: http ://jtds.sourceforge.net/faq.html

SQL server jdbc driver has these kind of properties trustStore and trustStorePassword, per this link: http://technet.microsoft.com/en-us/library/bb879949.aspx SQL Server jdbc驱动程序具有以下类型的属性trustStore和trustStorePassword,通过以下链接: http : //technet.microsoft.com/zh-cn/library/bb879949.aspx

Any idea how to configure ssl connection using jTDS with these properties? 任何想法如何使用具有这些属性的jTDS配置ssl连接?

you can specify the trustStore and keyStore location and their password dynamically through Java application as follow: 您可以通过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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM