SQLSTATE 24000 - Invalid Cursor State

前端 未结 1 581
花落未央
花落未央 2020-12-07 03:59

I connect to a DB2 database and makes the following query. I don\'t understand why I get the error: \"invalid cursor state\".

public static void blivPar(         


        
相关标签:
1条回答
  • 2020-12-07 04:32

    Found this on the JDBC Javadocs for the Statement interface: "The object used for executing a static SQL statement and returning the results it produces.

    By default, only one ResultSet object per Statement object can be open at the same time. Therefore, if the reading of one ResultSet object is interleaved with the reading of another, each must have been generated by different Statement objects. All execution methods in the Statement interface implicitly close a statment's current ResultSet object if an open one exists. " see Statement javadoc

    So it looks to me like you need two different Statements if you want two ResultSets open at the same time. Or you need to finish processing your first ResultSet and close it so you can re-use the Statement to create the second ResultSet.

    0 讨论(0)
提交回复
热议问题