0

I am trying to connect to db2 using spring jdbc template. Everything is working fine when deployed on tomcat server. But the same application when I am trying to deploy on WAS server is not working and giving me the below exception.

com.ibm.db2.jcc.am.DisconnectNonTransientConnectionException: [jcc][t4][2030][11211][3.69.66] 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: Received fatal alert: handshake_failure. ERRORCODE=-4499, SQLSTATE=08001

My datasource bean configuration is given below

 @Bean
    public DataSource dataSource() {
        DriverManagerDataSource dataSource=new DriverManagerDataSource();
        dataSource.setDriverClassName("com.ibm.db2.jcc.DB2Driver");
        dataSource.setUrl("url");
        dataSource.setUsername("username");
        dataSource.setPassword("password");
        Properties connectionProperties=new Properties();
        connectionProperties.setProperty("sslConnection", "true");
        connectionProperties.setProperty("sslTrustStoreLocation", "pathToFile");
        connectionProperties.setProperty("sslTrustStorePassword", "pass");
        dataSource.setConnectionProperties(connectionProperties);
        return dataSource;
    }
James Z
  • 12,209
  • 10
  • 24
  • 44
zakib
  • 11
  • 3
  • 1
    Have you tried the following? [How do I enable SSL encryption for DB2 Connections for WebSphere-based applications and datasources?](http://www-01.ibm.com/support/docview.wss?uid=swg21667093) – Mark Barinstein Oct 08 '18 at 15:44
  • handshake failure is SSL incompatibilities. Untrusted certificates, TLS version or cipher suites. – dbreaux Oct 08 '18 at 19:51
  • Is the driver the same version on both servers? 3.69.66 is DB2 10.5 FP8. There are newer versions available http://www-01.ibm.com/support/docview.wss?rs=71&uid=swg21363866 – Paul Vernon Oct 08 '18 at 20:32
  • Configure your data source via `server.xml` , not in the code. Just use JNDI name in code configuration. – Gas Oct 09 '18 at 09:42

0 Answers0