I am trying to connect to DB2 with SSL using Pyspark on Linux. I tried the following
user = "xxxx"
password = "xxxxx"
jdbcURL = "jdbc:db2://nn.nn.nnn.nnn:nnnn/<database>"
prop = {"user": user, "password": password, "driver":
"com.ibm.db2.jcc.DB2Driver", "sslConnection": "true"}
table = "<schema>.<table name>"
df = spark.read.jdbc(url=jdbcURL, table=table, properties=prop)
I also tried
user = "xxxx"
password = "xxxxx"
jdbcURL = "jdbc:db2://nn.nn.nnn.nnn:nnnn/<database>"
prop = {"user": user, "password": password, "driver":
"com.ibm.db2.jcc.DB2Driver", "sslConnection": "true"
"Security": "SSL", "SSLServerCertificate": "<path to arm file>"}}
table = "<schema>.<table name>"
df = spark.read.jdbc(url=jdbcURL, table=table, properties=prop)
I get the same error in both cases 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
I am not sure of the syntax to specify the .arm path. Stuck. Please help
Ganesh
P.S. I can connect with python and ibm_db module using
import ibm_db
conn = ibm_db.connect("DATABASE=<database>
;HOSTNAME=nn.nn.nnn.nnn:nnnn;SECURITY=SSL;SSLServerCertificate=<path to arm
file> ;UID=<user>;PWD=<password>","","")
This works.