Before SQL can read a row, the thread must connect with the right language interface and authority. This DB2 for z/OS page covers connection failures -922, -923, -924, -927, and privilege / SQLID failures -551, -552, -553.
Class 42 SQLSTATE values are authorization failures. Class 57 is resource/environment (“Db2 not up”). Class 51 is invalid application state (wrong attach). Class 58 is system error. Connection codes often mean no further SQL is safe until you reconnect correctly—IBM warns about unpredictable results after -922/-923/-924 in several cases.
| SQLCODE | SQLSTATE | Meaning |
|---|---|---|
| -922 | 42505 | Authorization failure establishing connection |
| -923 | 57015 | Connection not established (Db2 condition) |
| -924 | 58006 | Connection internal error |
| -927 | 51006 | LI called; connecting environment not established |
| -551 | 42501 | No privilege for operation on object |
| -552 | 42502 | Auth-id lacks privilege for operation |
| -553 | 42503 | Auth ID / schema name not valid for request |
IBM: AUTHORIZATION FAILURE: error-type ERROR. REASON reason-code. Error-type values:
System action: statement fails; connection to Db2 not established. SQLSTATE 42505. Attempts to issue SQL after -922 when error-type is not Connect can be unpredictable.
IBM: CONNECTION NOT ESTABLISHED: DB2 condition REASON reason-code, TYPE resource-type, NAME resource-name. Conditions include:
Allocation-error causes include:
System action: connection not established. Programmer response: wait if Db2 or objects are down; REBIND plan to surface allocation errors; fix CICS attachment then restart it. Further SQL after -923 can be unpredictable. SQLSTATE 57015.
123TSO symptom: job runs program without DSN → often -927 CICS symptom: attachment down → -923 with CICS attachment condition Plan missing: allocation error → REBIND and read bind messages
IBM: DB2 CONNECTION INTERNAL ERROR, function-code, return-code, reason-code. Unexpected internal failure establishing the connection. System action: not established. Programmer response: function/return codes may help; further SQL may be unpredictable. Escalate with reason-code documentation. SQLSTATE 58006.
IBM: THE LANGUAGE INTERFACE (LI) WAS CALLED WHEN THE CONNECTING ENVIRONMENT WAS NOT ESTABLISHED. THE PROGRAM SHOULD BE INVOKED UNDER THE DSN COMMAND.
TSO: ran the program without establishing the environment via DSN. IMS/CICS/RRSAF/CAF: wrong language interface module. Required modules:
Programmer response: TSO—invoke under DSN RUN. Other environments—link-edit or dynamically allocate the correct LI. DYNAM can load the wrong module at run time. SQLSTATE 51006.
1234567//* TSO batch under DSN (conceptual) //SYSTSIN DD * DSN SYSTEM(DB2A) RUN PROGRAM(MYPROG) PLAN(MYPLAN) - LIB('MY.LOAD.LIB') END /*
IBM: auth-id DOES NOT HAVE THE PRIVILEGE TO PERFORM OPERATION operation ON OBJECT object-name. None of the checked auth-ids or roles were authorized. Trusted context may show ROLE: role-name.
Common situations include:
System action: cannot process. Programmer response: verify authority, object existence, schema rules, and RACF/exit setup (ICH408I USER). SQLSTATE 42501.
1234-- Typical fix path (authorized DBA) GRANT SELECT, UPDATE ON EMP TO APPUSER; -- Application: ensure primary/secondary auth-id is APPUSER -- or SET CURRENT SQLID = 'APPUSER' when allowed (-553 if not)
IBM: authorization-id DOES NOT HAVE THE PRIVILEGE TO PERFORM OPERATION operation. Lacks required authority for the operation (may be a role under trusted context). Administrator should check for attempted authorization violation. Programmer: ensure the ID was granted the needed authority; SECADM required to revoke certain system authorities. SQLSTATE 42502.
Compared with -551: -551 names an object; -552 emphasizes the operation privilege itself (often broader / administrative).
IBM: AUTHORIZATION ID OR SCHEMA NAME name IS NOT VALID FOR REQUESTED OPERATION. Typical causes:
System action / response: change the name to a value the user can use. SQLSTATE 42503.
12345-- Fails with -553 if OTHERID is not primary/secondary for you SET CURRENT SQLID = 'OTHERID'; -- OK when OTHERID is in your secondary auth-id set SET CURRENT SQLID = 'OTHERID';
Start with -927 (LI/DSN), then -923 (Db2 up? plan allocate?), then -922 (user/plan auth), then -924 (internal).
-551 / -552 / -553. Dump CURRENT SQLID, primary auth, and the object name from SQLERRMC.
-927 is “you yelled into the library without walking through the door.” -923 is “the library building is closed or your membership card desk is offline.” -922 is “the guard says your badge is wrong.” -924 is “the door motor broke.” -551/-552 are “you are inside but not allowed to touch that book.” -553 is “you tried to wear someone else’s nametag and the rules said no.”
1. SQLCODE -922 means:
2. SQLCODE -923 means:
3. SQLCODE -927 typically means:
4. SQLCODE -551 means:
5. SQLCODE -553 is often about: