JavaEar 专注于收集分享传播有价值的技术资料

SQLCODE=-514 SQLSTATE=26501 occurred when I fnished the rebind operator

I want to make sure the new procedure valid, insteading of the DB2 always query by the cache pool, I have to rebind the database (db2rbind command). And then I deploy the application on WebSphere. BUT, when I login to the application, the error occurs:

 The cursor "SQL_CURSN200C4" is not in a prepared state..SQLCODE=-514  SQLSTATE=26501,DRIVER=3.65.97

further more, the most weird thing is that the error just occurred only once. It will not never occur after this time, and the application runs very well. I'm so curious about how it occurs and the reason why it only occurs only once. ps: my DB2 version is 10.1 Enterprise Server Edition. and the sql which the error stack point to is very simple just like:

select * from table where 1=1 and field_name="123" with ur

1个回答

    最佳答案
  1. Unless you configure otherwise (statementCacheSize=0) or manually use setPoolable(false) in your application, WebSphere Application Server data sources cache and reuse PreparedStatements. A rebind can cause statements in the cache to become invalid. Fortunately, WebSphere Application Server has built-in knowledge of the -514 error code and will purge the bad statement from the cache in response to an occurrence of this error, so that the invalidated prepared statement does not continue to be reused and cause additional errors to the application. You might be running into this situation, which could explain how the error occurs just once after the rebind.