Db2 Troubleshooting
SQLCODE -922 connection authorization failure
SQLCODE -922: connection authorization failure — the connection itself was rejected for security reasons.
What it means
- After every EXEC SQL, DB2 returns a SQLCODE: 0 means success, +100 means no row found, and negative values mean an error.
Common causes
- Wrong user ID or password for the DB2 connection.
- DRDA connection without proper credentials.
- Security exit rejecting the connection.
How to diagnose
- Verify the credentials used for the connection.
- Check with the DBA/security team for the expected auth method.
- Test the connection from a known-good tool.
How to fix it
- Correct the credentials.
- Use the approved connection method for the environment.
Example: Verify connection credentials
* Test with SPUFI/DSN first to isolate credentials
* from application issues.
-922 is about the connection, not the SQL.
Interview tip
- Q: How would you troubleshoot a SQLCODE -922 connection authorization failure in production?
- A: I would check the SQLCODE and SQLERRM immediately after the failing statement, reproduce in SPUFI, then apply the specific fix.
Prevention checklist
- Always check SQLCODE after every EXEC SQL statement.
- Log the SQLCODE, SQLSTATE and failing statement for support.
