AS400FileRecordDescription.retrieveRecordFormat 安全连接出错

AS400FileRecordDescription.retrieveRecordFormat error out on secured connection

下面java 程序的主要目的是使用jtopen(9.6 版)中的AS400FileRecordDescription class 检索iseries 上物理文件的记录格式。它通过调用此 class 中的 retrieveRecordFormat() 方法来实现。

如果连接是不安全的连接(连接 url 不包含 secure=true 参数),此程序工作正常。但是在安全连接下(连接 url 包含 secure=true 参数),它失败并出现此错误:"javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake"。知道我在这里做错了什么吗?

import java.sql.Connection;
import java.sql.DriverManager;
import com.ibm.as400.access.AS400;
import com.ibm.as400.access.AS400FileRecordDescription;
import com.ibm.as400.access.AS400JDBCConnection;
import com.ibm.as400.access.RecordFormat;

public class TestIseriesSecureConnection {

    public static void main(String[] args) {

        Connection conn = null;
        AS400 system = null;
        try {
            // get standard jdbc connection
            Class.forName("com.ibm.as400.access.AS400JDBCDriver");
            // notice the secure=true parameter, if that is removed, the program works fine.
            conn = DriverManager.getConnection("jdbc:as400://myiseries;secure=true;naming=system;errors=full;prompt=false;libraries=*LIBL;timeFormat=iso;dateFormat=iso;dateSeparator=-", "myuser", "mypassword");

            // cast connection into AS400 jdbc connection class to get the AS400 object
            AS400JDBCConnection as400Conn = (AS400JDBCConnection) conn;
            system = as400Conn.getSystem();

            // get the record format of a file on iseries
            RecordFormat recordFormats[] = null;
            AS400FileRecordDescription fileRecordDescription = new AS400FileRecordDescription(system, "/QSYS.LIB/%LIBL%.LIB/MYFILE.FILE");

            // This is where it error out if the connection is a secure connection 
            recordFormats = fileRecordDescription.retrieveRecordFormat();

            for (int myIx = 0; myIx < recordFormats.length; myIx++) {
                System.out.println(recordFormats[myIx].toString());
            }
            conn.close();
        }
        catch(Exception ex) {
            ex.printStackTrace();
        }
        finally {
            try {
                if (conn != null) {
                    conn.close();
                }
            }
            catch (Exception ex) {
                ex.printStackTrace();
            }
        }

        System.exit(0);
    }

}

什么版本的 IBM i OS?

Java 是什么版本?

在 IBM i 7.1 上并不罕见,因为它不支持最新版本的 TLS 和密码。

在与 IBM 支持人员反复沟通后,我们终于发现问题是由 retrieveRecordFormat 方法使用 DDM/DRDA 服务来处理请求引起的。我们已经在多个 diff 主机服务器上安装了 ssl 证书,但没有安装在 DDM/DRDA 上。这解释了为什么其他类型的请求在 ssl 下工作正常。因此,一旦我在 DDM/DRDA 主机服务器上安装了证书,即使使用普通的旧 AS400 对象,该程序也能正常工作。