Uploaded image for project: 'Apache Trafodion (Retired)'
  1. Apache Trafodion (Retired)
  2. TRAFODION-2686

use setCursorName(String name) of Statement to set Cursor Name fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • client-jdbc-t4
    • None

    Description

      use setCursorName(String name) of Statement to set Cursor Name fail:
      stmt.setCursorName("rsCursor");
      assertEquals("rsCursor", rs.getCursorName());
      expected:rsCursor,but was:SQL_CUR_5

      test code as following:
      public class TestSetCursorName {
      public static String driver = "xxxx";
      public static String url = "xxx";
      public static String user = "xx";
      public static String password = "xx";
      public static Connection conn = null;
      protected ResultSet rs = null;
      public static Statement stmt = null;
      private String select_dml = null;
      private String create_ddl = "";
      private String insert_dml = "";

      @Test
      public void testSetCursorName() throws SQLException{
      String tableName = "testsetCursorName";
      String schema = "testsSchema";
      try {
      Class.forName(driver);
      conn = DriverManager.getConnection(url, user, password);
      stmt = conn.createStatement();

      create_ddl = "create table " + schema + "." + tableName
      + "(" + "c_char char(30),"+ "c_integer integer" + ")";
      stmt.execute(create_ddl);
      insert_dml = "insert into " + schema + "." + tableName +""
      + " values(" + "'test char'," + 123 + ")";
      stmt.executeUpdate(insert_dml);
      select_dml = "select * from " + schema + "." + tableName;
      stmt.execute(select_dml);
      rs = stmt.getResultSet();
      assertNotNull(rs.getCursorName());
      stmt.setCursorName("rsCursor");
      assertEquals("rsCursor", rs.getCursorName());
      } catch (ClassNotFoundException e)

      { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); }

      finally

      { stmt.execute("drop table " + schema + "." + tableName ); stmt.close(); conn.close(); }

      }
      }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Howes 王宏伟
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: