svdb2
svdb2

Reputation: 1

Db2 Warehouse: How to connect using SSL with ibm data server driver

While trying to connect to Db2 Warehouse Local from clpplus as below giving an error

  ````
  clpplus -nw db2inst1@WP
  ````

jcc][t4][2030][11211][4.24.92] 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: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target. ERRORCODE=-4499, SQLSTATE=08001

My DB is SSL enabled and I have downloaded IBM data server client on Mac and created db2dsdriver.cfg as below

 db2cli writecfg add -database BLUDB -host db2inst1.zc.com -port 50001 

 db2cli writecfg add -dsn WP -database BLUDB -host db2inst1.zc.com -port 50001

 db2cli writecfg add -database BLUDB -host db2inst1.zc.com -port 50001 -parameter "SecurityTransportMode=SSL" `

Generally when connecting from dbvizualizer we use the below db connection url

BLUDB:sslConnection=true;sslTrustStoreLocation=/Users/Documents/truststore/ibm-truststore.jks;sslTrustStorePassword=<>;

I even tried to create the file as below but the same error persists

db2cli writecfg add -database BLUDB -host db2inst1.zc.com -port 50001 

db2cli writecfg add -dsn WP -database BLUDB -host db2inst1.zc.com -port 50001

db2cli writecfg add -database BLUDB -host db2inst1.zc.com -port 50001 -parameter "SecurityTransportMode=SSL" 

db2cli writecfg add -database BLUDB -host db2inst1.zc.com -port 50001 -parameter "sslTrustStoreLocation=/Users/Documents/truststore/ibm-truststore.jks" 

 db2cli writecfg add -database BLUDB -host db2inst1.zc.com -port 50001 -parameter "sslTrustStorePassword=<>" 

Actually, I'm trying to connect to Db2 Warehouse using ibm_db in a Juypter Notebook but for this, the DB should be cataloged and I'm unable to use the notebook because of this issue and also on mac db2 client is not supported and hence I have to go with data server client. So I need help in achieving this

Upvotes: 0

Views: 1368

Answers (1)

data_henrik
data_henrik

Reputation: 17118

To not have everything as comment, let's start composing an answer....

If you want to connect to Db2 Warehouse using clpplus and using SSL, there were changes starting in one of the latest versions of Db2 Warehouse. You would need to set up an IBM data server driver configuration file like this:

<configuration>
  <dsncollection>
    <dsn alias="SSLAMPLE" name="SAMPLE" host="9.121.221.159" port="50001">
    </dsn>
  </dsncollection>
  <databases>
    <database name="SAMPLE" host="9.121.221.159" port="50001">
      <parameter name="SecurityTransportMode" value="SSL"/>
    </database>
  </databases>
</configuration>

The above configures an alias SSLAMPLE for the database SAMPLE. With clpplus you would then connect to SSLAMPLE.

Upvotes: 1

Related Questions