• <small id='kJ2AB'></small><noframes id='kJ2AB'>

    • <bdo id='kJ2AB'></bdo><ul id='kJ2AB'></ul>
    <i id='kJ2AB'><tr id='kJ2AB'><dt id='kJ2AB'><q id='kJ2AB'><span id='kJ2AB'><b id='kJ2AB'><form id='kJ2AB'><ins id='kJ2AB'></ins><ul id='kJ2AB'></ul><sub id='kJ2AB'></sub></form><legend id='kJ2AB'></legend><bdo id='kJ2AB'><pre id='kJ2AB'><center id='kJ2AB'></center></pre></bdo></b><th id='kJ2AB'></th></span></q></dt></tr></i><div id='kJ2AB'><tfoot id='kJ2AB'></tfoot><dl id='kJ2AB'><fieldset id='kJ2AB'></fieldset></dl></div>

  • <legend id='kJ2AB'><style id='kJ2AB'><dir id='kJ2AB'><q id='kJ2AB'></q></dir></style></legend>

    <tfoot id='kJ2AB'></tfoot>

      1. SQLSTATE 24000 - 游标状态无效

        SQLSTATE 24000 - Invalid Cursor State(SQLSTATE 24000 - 游标状态无效)
          <tbody id='JKnSn'></tbody>

        <legend id='JKnSn'><style id='JKnSn'><dir id='JKnSn'><q id='JKnSn'></q></dir></style></legend>

          <small id='JKnSn'></small><noframes id='JKnSn'>

            <tfoot id='JKnSn'></tfoot>

            • <bdo id='JKnSn'></bdo><ul id='JKnSn'></ul>
              1. <i id='JKnSn'><tr id='JKnSn'><dt id='JKnSn'><q id='JKnSn'><span id='JKnSn'><b id='JKnSn'><form id='JKnSn'><ins id='JKnSn'></ins><ul id='JKnSn'></ul><sub id='JKnSn'></sub></form><legend id='JKnSn'></legend><bdo id='JKnSn'><pre id='JKnSn'><center id='JKnSn'></center></pre></bdo></b><th id='JKnSn'></th></span></q></dt></tr></i><div id='JKnSn'><tfoot id='JKnSn'></tfoot><dl id='JKnSn'><fieldset id='JKnSn'></fieldset></dl></div>

                • 本文介绍了SQLSTATE 24000 - 游标状态无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我连接到一个 DB2 数据库并进行以下查询.我不明白为什么会出现错误:无效的游标状态".

                  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() {
                              try {
                                  Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
                                  stmt.setMaxRows(1000);
                  
                                  ResultSet drenge = stmt.executeQuery("SELECT * FROM People WHERE sex='M'");
                                  ResultSet piger = stmt.executeQuery("SELECT * FROM People WHERE sex='F'");
                                  drenge.first();
                                  piger.first();
                                  int i=0;
                                  while(drenge.next()) {
                                      while(piger.next()) {
                                          i++;
                                          System.out.print(i);
                                          stmt.execute("INSERT INTO Couples Values ('"+drenge.getString(1) +
                                                  "','" + drenge.getString(2) +
                                                  "','" + piger.getString(1) +
                                                  "','" + piger.getString(2) + "')");
                                      }
                                  }
                              } catch (Exception ex) {
                                  ex.printStackTrace();
                              }
                  
                          }
                  

                  谢谢.

                  推荐答案

                  在 JDBC Javadocs 上找到了 Statement 接口的这个:用于执行静态 SQL 语句并返回它产生的结果的对象.

                  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.

                  默认情况下,每个 Statement 对象只能同时打开一个 ResultSet 对象.因此,如果一个 ResultSet 对象的读取与另一个 ResultSet 对象的读取交错,则每个都必须由不同的 Statement 对象生成. Statement 接口中的所有执行方法都会隐式关闭一个 statment 的当前 ResultSet 对象,如果存在打开的对象."请参阅 声明 javadoc

                  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

                  所以在我看来,如果您希望同时打开两个结果集,您需要两个不同的语句.或者您需要完成第一个 ResultSet 的处理并关闭它,以便您可以重新使用 Statement 来创建第二个 ResultSet.

                  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.

                  这篇关于SQLSTATE 24000 - 游标状态无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)

                  1. <tfoot id='Vx4ae'></tfoot>
                          • <bdo id='Vx4ae'></bdo><ul id='Vx4ae'></ul>
                              <tbody id='Vx4ae'></tbody>

                            <legend id='Vx4ae'><style id='Vx4ae'><dir id='Vx4ae'><q id='Vx4ae'></q></dir></style></legend>

                            <i id='Vx4ae'><tr id='Vx4ae'><dt id='Vx4ae'><q id='Vx4ae'><span id='Vx4ae'><b id='Vx4ae'><form id='Vx4ae'><ins id='Vx4ae'></ins><ul id='Vx4ae'></ul><sub id='Vx4ae'></sub></form><legend id='Vx4ae'></legend><bdo id='Vx4ae'><pre id='Vx4ae'><center id='Vx4ae'></center></pre></bdo></b><th id='Vx4ae'></th></span></q></dt></tr></i><div id='Vx4ae'><tfoot id='Vx4ae'></tfoot><dl id='Vx4ae'><fieldset id='Vx4ae'></fieldset></dl></div>

                            <small id='Vx4ae'></small><noframes id='Vx4ae'>