I am converting an application to use DB2/CLI (v9.1) on solaris. I am experiencing a very few, random SQL0504N errors when running through a regression pack.
I have stepped through the application and observed this behaviour first hand. This is roughly what I observe: -
- the application uses "UPDATE ... WHERE CURRENT OF ... " techniques
- the application may create and free lots of statement handles, with around 100 being in existence at any one time
- SQLPrepare has been executed for a statement (albeit maybe a while ago)
- an appropriate SQLExecute/SQLFetch has occurred for the prepared statement, both succeeding and returning data
- SQLGetCursorName on the "SELECT .. FOR UPDATE" statement succeeds and a cursor name is returned
- SQLExecDirect ("WHERE CURRENT OF ..") fails with SQL0504N
- there have been no calls to close/free statement on the cursor in question
Has anyone else experienced this? I'm trying to determine whether the problem lies in application code, or DB2.
Does anyone have any good approaches with which to investigate more fully? I'm currently using a debugger, but would be interested if theres any way to check the statement cache in DB2 to find out cursor names in existence, current state etc.
Any help would be appreciated.