IBM Support

DB2JDBCException: Connection Authorization Failure Occurred

Troubleshooting


Problem

The "com.ibm.db2.jdbc.app.DB2JDBCException: Connection authorization failure occurred." exception is thrown when a JDBC connection has been set to read only, but a non-read access is attempted.

Resolving The Problem

This exception is thrown when a JDBC connection is set to read-only, but a non-read access is attempted. A connection can be set to read only using one of the following methods: the "access=read only" connection property or the JDBC setReadOnly() method.

Applications that use setReadOnly() with connection pooling must be careful to always call setReadOnly(false) before returning a connection to the pool. Most pool managers do not reset properties. If the property is not reset, another part of the application might experience connection authorization failures when it attempts to use the same underlying JDBC connection. The problem might appear intermittent because the pool can give different connections, each with a different setting.

The call stack will appear similar to the following:

com.ibm.db2.jdbc.app.DB2JDBCException: Connection authorization failure occurred.
      java/lang/Throwable.<init>(Ljava/lang/String;)V+4 (Throwable.java:90)
      java/sql/SQLException.<init>(Ljava/lang/String;Ljava/lang/String;I)V+1 (SQLException.java:39)
      com/ibm/db2/jdbc/app/DB2Exception.<init>(Ljava/lang/String;Ljava/lang/String;I)V+1 (DB2Exception.java:49)
      com/ibm/db2/jdbc/app/DB2PreparedStatement.execute()Z+12 (DB2PreparedStatement.java:1492)
      com/ibm/db2/jdbc/app/DB2PreparedStatement.executeUpdate()I+12 (DB2PreparedStatement.java:308)

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CbKAAU","label":"Data Access-\u003EIBM i Toolbox for Java"},{"code":"a8m3p000000PCRtAAO","label":"Data Access-\u003ENative JDBC"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Historical Number

27923946

Document Information

Modified date:
18 April 2025

UID

nas8N1016865