开发者

db2 SQLCODE=-243, SQLSTATE=36001 ERROR

开发者 https://www.devze.com 2023-04-06 15:24 出处:网络
I am using the DB2Driver in my code like Class.forName(\"com.ibm.db2.jcc.DB2Driver\"); and I am getting the result set i开发者_Python百科n my java code which is scroll sensitive. my sql query look

I am using the DB2Driver in my code like

Class.forName("com.ibm.db2.jcc.DB2Driver");

and I am getting the result set i开发者_Python百科n my java code which is scroll sensitive. my sql query look like this select distinct day , month , year from XXX . here table XXX is read only for the user which I am using ... so it is giving the following error

com.ibm.db2.jcc.a.SqlException: DB2 SQL Error: SQLCODE=-243, SQLSTATE=36001, SQLERRMC=SQL_CURSH200C3, DRIVER=3.51.90 .. I know this is the problem of read only .. but when i try to execute the same query in db2 control center it is working

please help me out in this


PubLib is your friend :-)

SQL0243N
SENSITIVE cursor <cursor-name> cannot be defined for the specified SELECT statement.

Explanation:

Cursor <cursor-name> is defined as SENSITIVE, but the content of the SELECT statement requires DB2 to build a temporary result table of the cursor, and DB2 cannot guarantee that changes made outside this cursor will be visible. This situation occurs when the content of the query makes the result table read-only. For example, if the query includes a join, the result table is read-only. In these cases, the cursor must be defined as INSENSITIVE or ASENSITIVE.

The statement cannot be processed.

User response:

Either change the content of the query to yield a result table that is not read-only, or change the type of the cursor to INSENSITIVE or ASENSITIVE.

If you can't change the cursor type, look in to the use of materialised queriey tables. These are like views but also provide temporary backing storage for the data so that it's not forced read-only by the query type.

Whether that will help in situations where you've forced the user to be read only, I'm not entirely sure but you may be able to have different permission on the materialised data and real data (unfortunately, I haven't done a lot of work with these, certainly none where permissions were locked down to read-only level).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号