DB2でSSLを有効にするために、以下のリンクで説明されているすべての手順を実行しました。
http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.sec.doc%2Fdoc%2Ft0025241.html
その後、以下のコマンドを使用して証明書を cacerts に追加しました。
keytool -import -file "C:\\Program Files\\IBM\\gsk8\\bin\\keystore.arm" -alias keystore -keystore "C:\\Program Files\\Java\\jre6\\lib\\security\\cacerts"
コードに次の行を書きました。
DB2ConnectionPoolDataSource dataSource = new DB2ConnectionPoolDataSource();
dataSource.setSslConnection(true);
dataSource.setSslTrustStoreLocation("trust store file path");
dataSource.setSslTrustStorePassword("changeit");
PooledConnection ps = dataSource.getPooledConnection();
connection = ps.getConnection();
ハンドシェイク例外が発生しています。以下はスタックトレースです。
com.ibm.db2.jcc.am.DisconnectNonTransientConnectionException: [jcc][t4][2030][11211][4.16.53] A communication error occurred during operations on the connection's underlying socket, socket input stream,
or socket output stream. Error location: Reply.fill() - socketInputStream.read (-1). Message: Remote host closed connection during handshake. ERRORCODE=-4499, SQLSTATE=08001
at com.ibm.db2.jcc.am.fd.a(fd.java:320)
at com.ibm.db2.jcc.t4.a.a(a.java:526)
at com.ibm.db2.jcc.t4.a.a(a.java:510)
at com.ibm.db2.jcc.t4.a.a(a.java:505)
at com.ibm.db2.jcc.t4.a.b(a.java:1557)
at com.ibm.db2.jcc.t4.a.a(a.java:1592)
at com.ibm.db2.jcc.t4.a.f(a.java:452)
at com.ibm.db2.jcc.t4.a.flush_(a.java:387)
at com.ibm.db2.jcc.am.Agent.flowOutsideUOW(Agent.java:261)
at com.ibm.db2.jcc.t4.b.b(b.java:1224)
at com.ibm.db2.jcc.t4.b.b(b.java:793)
at com.ibm.db2.jcc.t4.b.a(b.java:765)
at com.ibm.db2.jcc.t4.b.a(b.java:423)
at com.ibm.db2.jcc.t4.b.a(b.java:398)
at com.ibm.db2.jcc.t4.b.<init>(b.java:336)
at com.ibm.db2.jcc.DB2PooledConnection.<init>(DB2PooledConnection.java:83)
at com.ibm.db2.jcc.DB2ConnectionPoolDataSource.getPooledConnectionX(DB2ConnectionPoolDataSource.java:348)
at com.ibm.db2.jcc.DB2ConnectionPoolDataSource.getPooledConnection(DB2ConnectionPoolDataSource.java:131)
at db2.DB2SSLConfiguration.buildConnection(DB2SSLConfiguration.java:210)
at db2.DB2SSLConfiguration.main(DB2SSLConfiguration.java:152)
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
at com.ibm.db2.jcc.t4.db.b(db.java:1715)
at com.ibm.db2.jcc.t4.db.a(db.java:1663)
at com.ibm.db2.jcc.t4.a.f(a.java:437)
... 13 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
... 20 more
これに関するポインタは高く評価されます。