I am using TYPE_SCROLL_SENSITIVE and CONCUR_READ_ONLY to iterate through the result set object in both directions.
statement = connection.prepareStatement(query, rs.TYPE_SCROLL_SENSITIVE,rs.CONCUR_READ_ONLY); Query: SELECT DISTINCT POL_NO, P_CODE, P_LN, MAX(EFF_DT) AS EFF_DT, T_TYP, PER_FROM,
PER_TO, BUS_TYP FROM DMGT.ARC WHERE BUS_TYP IN ('C', 'P') AND POL_NO = ?
AND (ERR_IND ! = 'X' OR ERR_IND IS NULL) GROUP BY T_TYP, PER_FROM, PER_TO,
POL_NO, P_LN, P_CODE, BUS_TYP ORDER BY EFF_DT DESC
I am able to get the data from data base DB2 in local (Windows box) but Iam faccing problem mentioned below in DEV (unix box).
Note: Both enviroments(local and dev) using same database(DB2 version 9.1) and different websphere application servers (but versions are same v6.1).we are getting the connection from the connection pooling .
Please suggest me on this and also advance thanks to all.
Error: SENSITIVE CURSOR SQL_CURLN300C1 CANNOT BE DEFINED FOR THE SPECIFIED SELECT STATEMENT
I'm not experienced with DB2, but from this explanation of the error message I guess that the DEV database is obtaining the data through a different plan (storing the results in a temp table) for some reason.
Check for any difference between the two databases. I don't know how this is in DB2, but in Oracle a query plan might change for a large number of reasons:
- different indexes,
- different amount of data in table,
- different clustering factor of indexes,
- different collection of statistics (or lack of thereof),
- different system parameters,
- different architecture.
I may be mistaken; it is also possible that DB2 won't switch query plans so readily. But if it does, the feature you use (sensitive resultset) is very fragile and might stop working even after some innocuous change.