The default security authorization strategy when connecting to DB2 is that the JDBC driver send the the database password in clear text to the database server. The following is useful when the security mechanism on the server has been changed to be more restrictive and when errors such as the following are reported at connect:
Connection authorization failure occurred. Reason: Security mechanism not supported.
ERRORCODE=-4214, SQLSTATE=28000
Or:
Caught java.security.InvalidAlgorithmParameterException while initializing EncryptionManager.
ERRORCODE=-4223
Solution 1
The different options for the security mechanism setting are the following, where the default is
CLEAR_TEXT_PASSWORD_SECURITY = 3
:
USER_ONLY_SECURITY = 4
CLEAR_TEXT_PASSWORD_SECURITY = 3
ENCRYPTED_PASSWORD_SECURITY = 7
ENCRYPTED_USER_ONLY_SECURITY = 16
ENCRYPTED_USER_AND_PASSWORD_SECURITY = 9
ENCRYPTED_USER_AND_DATA_SECURITY = 12
ENCRYPTED_USER_PASSWORD_AND_DATA_SECURITY = 13
KERBEROS_SECURITY = 11
PLUGIN_SECURITY = 15
TLS_CLIENT_CERTIFICATE_SECURITY = 18
To set the security mechanism in DbVisualizer, open the
Properties
tab for your DB2 connection and in the list of categories select
Driver Properties
. In the right grid, add a new row and specify
securityMechanism
in the
Parameter
field and in the
Value
field pick the number for the correct (check with your DBA what level to use) level in the table above. Click
OK
and connect.
Solution 2
If you still have problems getting connected after trying these two solutions, check with your DBA as this is related to the DB2 setup rather than DbVisualizer.