Db2 Troubleshooting
SQLCODE -805 package not found
SQLCODE -805: package not found — DB2 cannot find the package for your program in the plan.
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
- Program was bound to a different collection, or not bound at all after a change.
- Plan points to the wrong package collection.
- Timestamp mismatch: program and package consistency tokens differ.
How to diagnose
- Verify the bind: which collection was the DBRM bound into?
- Check the plan's PKLIST for the right collection.
- Confirm the program was rebound after the last compile.
How to fix it
- BIND the program into the correct collection.
- Fix the plan PKLIST or use a collection the program is bound in.
- Rebind after every compile that changes the DBRM.
Example: Bind into the right collection
BIND PLAN(PAYPLAN) PKLIST(PAYCOLL.*) ACTION(REPLACE)
*> then re-run the program
The collection in PKLIST must contain your package.
Interview tip
- Q: How would you troubleshoot a SQLCODE -805 package not found 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.
