How to implement a encrypted connection to a SAP Hana DB instance in Java

38 views Asked by At

I am trying to use the Java JDBC driver for SAP Hana DB to connect to a Hana database with an encrypted connection. I have configured the driver with a JDBC connection string in the manner that the documentation suggests, but I am unable to connect.

I have tried the following

  1. Created a trust store file with the certificate of the Hana server that I am attempting to connect to. The trust store is called myTrustStoreFile

  2. The program uses the following JDBC connection string

dbc:sap://myserver:31113/?encrypt=true&keystore=./myTrustStoreFile&keystorepassword=ABCDE1234&keyStoreType=JKS&validateCertificate=true

When the Java program runs, it will produce the following error

SAP DBTech JDBC: Cannot connect to jdbc:sap://myserver:31113/ [Data receive failed. java.io.IOException: Connection reset by peer: 127.0.1.1:99999 -> myserver:31113 ConnectionID:0 SessionID:0].

I have tested the connection with the same server, username, password, key store file and key store file password using the SAP HDB Studio application. I enabled the logging in this application and looked at the NGDBC.jar file trace output, which is performing apparently the same operations, i.e the Connection string it uses is the same, and the SAP HDB Studio program does connect.

My suspicion is that the OpenSSL connection is not working correctly - Maybe there is no handshake? Do I need to add other items to the Key Store?

I have looked on this site, and I did find this question but it does not really go into any details.

I am at a loss as to how to proceed, and in fact, if I am approaching this is the correct manner. Any suggestions would be welcome.

0

There are 0 answers