# SQLCODE -924: Db2 connection internal error

Source: https://wndsoftware.com/mainframe-errors/sqlcode-924

### SQLCODE -924: Db2 connection internal error

SQLCODE -924 (SQLSTATE 58006) means the attempt to connect to Db2 failed because of an unexpected internal error. The message carries a function code, a return code and a Db2 reason code, and the reason code tells you what went wrong.


#### Other names for this code

Also written as `SQL -924`, `SQLCODE=-924`, `SQLCODE = -924`, `db2 -924`, `sqlstate 58006`, `db2 connection internal error`, `-924 reason code`.


### What it means

-924 belongs to the same family as -922 and -923. All three mean the program never got a working connection to Db2. -922 is a security refusal and -923 is a known condition such as Db2 not being up. -924 covers failures the attachment didn't expect.

The message has three values after the text.

- The function code  is the request the attachment was making.
- The return code  is what came back.
- The reason code  is an eight-digit Db2 reason code, such as one in the 00F3 range. It explains the failure.

The SQLCODE itself says little. Everything useful is in the reason code, which you look up in the Db2 for z/OS Codes manual. Reason codes in the 00F3 range, for example, come from the part of Db2 that supports connections from other address spaces. The entry for the code tells you whether the problem is in how the program connects or inside Db2.

IBM warns that SQL issued after -924 may give unpredictable results, so the program shouldn't try to carry on.


### Common causes

- The program's CAF or RRSAF connection logic makes calls in the wrong order, or one task tries to use a connection that another task created.
- Db2 was stopped or restarted while a long-running program held a connection, and the program carried on calling Db2 without connecting again.
- An internal problem in the attachment or in Db2, which usually comes with a dump or console messages.


### How to find the problem

- Write down the function code, return code and reason code from the message.
- Look up the reason code in the Db2 for z/OS Codes manual. Its explanation and problem determination section say what to check.
- Check SYSLOG and the console around the failure time for Db2 restart or shutdown messages, CANCEL THREAD commands and any dumps.
- For a CAF or RRSAF program, review the sequence of connection calls and which task makes them.


### How to fix it

- Fix what the reason code points to, then connect again from scratch.
- For long-running programs, add logic that connects again after Db2 is restarted, instead of reusing the old connection.
- Correct the order of CAF or RRSAF calls so each task connects before it opens a thread and runs SQL.
- If the reason code points to an internal error, collect the dumps, SYSLOG and the message, and open a case with IBM Support.


### IBM documentation

[IBM documentation: -924](https://www.ibm.com/docs/en/db2-for-zos/13.0.0?topic=codes-924). Use the documentation for your installed release.

[Report a correction to WND Software](https://wndsoftware.com/contact#message).

Technical reviewer: [Albert Joseph](https://wndsoftware.com/authors/albert-joseph), WND Software.

Last reviewed 2026-10-18 by the WND Software team. Written in our own words. For the full reference, check IBM’s Db2 for z/OS documentation for your release.


### Related codes

[SQLCODE -923 Connection not established Read →](https://wndsoftware.com/mainframe-errors/sqlcode-923)
[SQLCODE -922 Authorization failure Read →](https://wndsoftware.com/mainframe-errors/sqlcode-922)
[SQLCODE -927 Language interface called without a connection Read →](https://wndsoftware.com/mainframe-errors/sqlcode-927)
[SQLCODE -900 Not connected to a server Read →](https://wndsoftware.com/mainframe-errors/sqlcode-900)
[SQLCODE -901 System error, later statements can run Read →](https://wndsoftware.com/mainframe-errors/sqlcode-901)

### Questions


#### Is -924 always a Db2 bug?

No. Many reason codes point to how the program connects, such as reusing a connection after Db2 restarted. Look the reason code up before calling it a defect.


#### Where do I find what the reason code means?

In the Db2 for z/OS Codes manual, under Db2 reason codes. The codes are eight hex digits, such as one in the 00F3 range.


#### How is -924 different from -927?

-927 means the program called Db2 without any connection environment set up. -924 means the connection was being made or used and failed with an internal error.

[Db2 SQLCODEs](https://wndsoftware.com/mainframe-errors/db2-sqlcodes) · [SQLCODE -923](https://wndsoftware.com/mainframe-errors/sqlcode-923) · [SQLCODE -925](https://wndsoftware.com/mainframe-errors/sqlcode-925)

[← All error codes](https://wndsoftware.com/mainframe-errors/)
