Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1127

Statement.getResultSetType () seems failed to change the result set type

    XMLWordPrintable

Details

    Description

      @Test
      public void test() throws SQLException {
          Connection con = null;
          Statement stmt = null;
          ResultSet rs = null;
          con = DriverManager.getConnection("jdbc:mariadb://localhost:3366/test69?user=user&password=password");
          stmt = con.createStatement(1004, 1008, 2);
          stmt.addBatch("DROP TABLE IF EXISTS table0_0;");
          stmt.addBatch("CREATE TABLE table0_0(id INT AUTO_INCREMENT PRIMARY KEY,value INT);");
          stmt.addBatch("INSERT INTO table0_0 VALUES(1, -179653912)");
          stmt.addBatch("INSERT INTO table0_0 VALUES(2, 1207965915)");
          stmt.executeBatch();
          stmt.executeUpdate("INSERT INTO table0_0 (value) VALUES(667711856)", Statement.RETURN_GENERATED_KEYS);
          rs = stmt.getGeneratedKeys();
          System.out.println(stmt.getResultSetType()); // 1004
          System.out.println(rs.getType()); // 1003
      }
      

      When a Statement is created with a specific ResultSet type 1004, the expectation is that any ResultSet derived from this Statement should have the same type. However, in the provided test case, the ResultSet obtained from getGeneratedKeys() reports a type of ResultSet.TYPE_FORWARD_ONLY (1003), which is inconsistent with the type specified when creating the Statement.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            dwenking Wenqian Deng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.