Rahul Khimasia
Rahul Khimasia

Reputation: 503

Connecting to Db2 on z/OS via JDBC using IBM JDK vs OpenJDK

I am able to connect to Db2 on z/OS with the IBM universal JDBC driver file db2jcc4.jar using IBM JDK 1.8 that is bundled with WebSphere 9. Every thing works fine and I can browse the catalog and execute queries. I used Squirrel SQL version 4.0.0.

But when I switch my JDK to the Open JDK 8 or 12 while keeping everything else the same, I get the following error. What should be done to fix this error? What is the difference between IBM JDK and Open JDK, which causes the DB2 connection to work with one JDK and fail with the other?

error when using Open JDK 12

Upvotes: 0

Views: 1322

Answers (2)

Timothy Sipples
Timothy Sipples

Reputation: 134

According to IBM's documentation for their IBM Data Server Driver for JDBC and SQLJ, error code -4214 is an "Authorization failed" error -- and you know that much. But you can get more specific information about the problem if you call SQLException.getMessage. I think you may have done that already, but it's not entirely clear.

My semi-educated guess is that you haven't yet followed the configuration steps in IBM's driver documentation in the section "Configuring the Java Runtime Environment to Use SSL":

https://www.ibm.com/support/knowledgecenter/SSEPGG_11.5.0/com.ibm.db2.luw.apdv.java.doc/src/tpc/imjcc_t0054066.html

You'll have to apply some common sense knowledge to those instructions to adapt them for the OpenJDK, and this might not be an IBM supported combination depending on what/how you do it. If you can somehow use the IBMJSSE2 Provider, that'd be nice.

I think Mao and Mustaccio probably have the right ideas, and probably you're just missing the server certificate in your truststore. The instructions linked above walk you through how to configure that.

Upvotes: 1

hidehy
hidehy

Reputation: 304

Here is one of matching articles of your case:
JDBC application may receive error "Security mechanism not supported"
https://www.ibm.com/support/pages/jdbc-application-may-receive-error-security-mechanism-not-supported

Resolving The Problem

Set the following property :

securityMechanism = ENCRYPTED_USER_PASSWORD_AND_DATA_SECURITY (13)

Alternatively you can set property retryWithAlternativeSecurityMechanism to YES(1).

Hope this helps.

Upvotes: 0

Related Questions