【发布时间】:2018-07-31 00:14:09
【问题描述】:
远程服务器是安装了 DB2 的 IBM i (7.1)。我正在尝试使用 Windows 机器上的 SSL 通过 JDBC 加密链接连接到 IBM i 机器上的远程 db2 数据库,我使用的是 jt400-6.7.jar。 我可以看到在 IBM i 机器上正确配置了 SSL,因为我在 Digital Certificate Manager 中看到了以下内容:
Current Certificate Store
You have selected to work with the certificate store listed below. The left frame is being refreshed to show the task list for this certificate store. Select a task from the left frame to begin working with this certificate store.
Certificate type: Server or client
Certificate store: *SYSTEM
Certificate store path and filename:
/QIBM/USERDATA/ICSS/CERT/SERVER/DEFAULT.KDB
我点击此链接在我的 IBM i 机器上设置 SSL: https://isupport.krengeltech.com/rxs/setting_up_ssl/
这是我在 Windows 10 机器上执行的 JDBC 程序:
import java.sql.*;
public class IBMiSSLConnect
{
public static void main(String[] args) throws Exception
{
try
{
Class.forName("com.ibm.as400.access.AS400JDBCDriver");
Connection con = DriverManager.getConnection("jdbc:as400://IBMiMachineIP:5021/DBNAME&secure=true", "USER", "PASSWORD");
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
我收到以下错误:
[PWS0082] 库未添加到库列表中。
如果我将 url 替换如下(添加系统库):
Connection con = DriverManager.getConnection("jdbc:as400://IBMiMachineIP:5021/DBNAME;naming=system;libraries=QSYS;secure=true", "USER", "PASSWORD");
我收到以下错误:
应用程序请求者无法建立连接。 (sun.security.validator.ValidatorException:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径)
我有两个问题:
Q 1:是否总是需要在 url 中添加命名和库以使用 SSL 进行 JDBC 加密?
像这样:
dbc:as400://someserver;naming=system;libraries=devfiles,prodfiles,sysibm,etc
我指的是这个链接:
How can I insert additional libraries to my jdbc/DB2 connection?
问 2:我应该使用安全连接还是 sslConnection 作为 url 参数? 那就是:
a:jdbc:as400://IBMiMachineIP:5021/DBNAME&secure=true
或
b: jdbc:as400://IBMiMachineIP:5021/DBNAME&sslConnection=true
*注意:我已经对信任库文件 default.kdb 和 default.rdb 的 SSL 权限进行了更改,如下所述:
https://isupport.krengeltech.com/rxs/configuring_ssl_permissions/
【问题讨论】:
标签: ssl encryption jdbc db2-400