Pivotal Knowledge Base

Follow

Tomcat: How To Connect to DB2 with Security Enabled

Environment

 Product  Version
 Tc Server / Tomcat  Any

Symptoms

You see the following error when connecting to the DB2 database using JDBC connection pool.

javax.naming.NamingException: [jcc][t4][201][11237][3.65.131] Connection authorization
failure occurred. Reason: Security mechanism not supported. ERRORCODE=-4214 SQLSTATE=280  

Cause

When the parameter AUTHENTICATION is set to SERVER_ENCRYPT, you need to give some extra configuration commands to the connection pool resource. 

Resolution

Add the following attribute to the connection pool resource configuration:

connectionProperties="securityMechanism=9;encryptionAlgorithm=2"

The resource configuration should look like this:

<Resource name="jdbc/TestDB"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
testWhileIdle="true"
testOnBorrow="true"
.
.
.
connectionProperties="securityMechanism=9;encryptionAlgorithm=2" />

   

Comments

Powered by Zendesk